mvn install有些依赖包在maven仓库找不到会有问题
PS D:\WrokSpaces\Trunk\BMS-SD\branches> mvn install
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.xintuyun:sdbms:war:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: junit:junit:jar -> version 3.8.1 vs ${junit.version} @ line 587, column 25
[WARNING] 'build.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.apache.maven.plugins:maven-surefire-plugin @ line 702, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] -------------------------< com.xintuyun:sdbms >-------------------------
[INFO] Building bms Maven Webapp 0.0.1-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
Downloading from central: https://repo.maven.apache.org/maven2/com/oracle/ojdbc6/11.2/ojdbc6-11.2.pom
[WARNING] The POM for com.oracle:ojdbc6:jar:11.2 is missing, no dependency information available
Downloading from central: https://repo.maven.apache.org/maven2/com/microsoft/sqlserver/sqljdbc4/4.0/sqljdbc4-4.0.pom
[WARNING] The POM for com.microsoft.sqlserver:sqljdbc4:jar:4.0 is missing, no dependency information available
Downloading from central: https://repo.maven.apache.org/maven2/com/hession/hessian/3.1.5/hessian-3.1.5.pom
[WARNING] The POM for com.hession:hessian:jar:3.1.5 is missing, no dependency information available
Downloading from central: https://repo.maven.apache.org/maven2/com/hessionweb/hessionweb/3.2/hessionweb-3.2.pom
[WARNING] The POM for com.hessionweb:hessionweb:jar:3.2 is missing, no dependency information available
Downloading from central: https://repo.maven.apache.org/maven2/net/sourceforge/pinyin4j/pinyin4j/2.5.0/pinyin4j-2.5.0.pom
[WARNING] The POM for net.sourceforge.pinyin4j:pinyin4j:jar:2.5.0 is missing, no dependency information available
[WARNING] The artifact jdom:jdom:jar:1.1 has been relocated to org.jdom:jdom:jar:1.1
Downloading from central: https://repo.maven.apache.org/maven2/com/oracle/ojdbc6/11.2/ojdbc6-11.2.jar
Downloading from central: https://repo.maven.apache.org/maven2/net/sourceforge/pinyin4j/pinyin4j/2.5.0/pinyin4j-2.5.0.jar
Downloading from central: https://repo.maven.apache.org/maven2/com/hessionweb/hessionweb/3.2/hessionweb-3.2.jar
Downloading from central: https://repo.maven.apache.org/maven2/com/hession/hessian/3.1.5/hessian-3.1.5.jar
Downloading from central: https://repo.maven.apache.org/maven2/com/microsoft/sqlserver/sqljdbc4/4.0/sqljdbc4-4.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.388 s
[INFO] Finished at: 2019-01-05T03:19:55+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project sdbms: Could not resolve dependencies for project com.xintuyun:sdbms:war:0.0.1-SNAPSHOT: The following artifacts could not be resolved: com.oracle:ojdbc6:jar:11.2, com.microsoft.sqlserver:sqljdbc4:jar:4.0, com.hession:hessian:jar:3.1.5, com.hessionweb:hessionweb:jar:3.2, net.sourceforge.pinyin4j:pinyin4j:jar:2.5.0: Could not find
artifact com.oracle:ojdbc6:jar:11.2 in central (https://repo.maven.apache.org/maven2) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException
安装ojdbc6
注意:使用这条命令必须在jar所在的文件夹
mvn install:install-file -Dfile=jar包的位置 -DgroupId=jar的groupId -DartifactId=jar的artifactId -Dversion=jar的version -Dpackaging=jar文件名
mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2 -Dpackaging=jar -Dfile=ojdbc6-11.2.jar
image.png
安装成功:
$ mvn install:install-file -DgroupId=com.oracle -DartifactId=ojdbc6 -Dversion=11.2 -Dpackaging=jar -Dfile=ojdbc6-11.2.jar
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< org.apache.maven:standalone-pom >-------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] --------------------------------[ pom ]---------------------------------
[INFO]
[INFO] --- maven-install-plugin:2.4:install-file (default-cli) @ standalone-pom ---
[INFO] Installing C:\Users\Administrator\Desktop\lib\oracle\ojdbc6\11.2\ojdbc6-11.2.jar to C:\Users\Administrator\.m2\repository\com\oracle\ojdbc6\11.2\ojdbc6-11.2.jar
[INFO] Installing C:\Users\ADMINI~1\AppData\Local\Temp\mvninstall538531980351771366.pom to C:\Users\Administrator\.m2\repository\com\oracle\ojdbc6\11.2\ojdbc6-11.2.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.984 s
[INFO] Finished at: 2019-01-05T03:40:51+08:00
[INFO] ------------------------------------------------------------------------
配置pom.xml
<!-- oracel driver setting -->
<jdbc.driver.oracle.groupId>com.oracle</jdbc.driver.oracle.groupId>
<jdbc.driver.oracle.artifactId>ojdbc6</jdbc.driver.oracle.artifactId>
<jdbc.driver.oracle.version>11.2</jdbc.driver.oracle.version>
<dependency>
<groupId>${jdbc.driver.oracle.groupId}</groupId>
<artifactId>${jdbc.driver.oracle.artifactId}</artifactId>
<version>${jdbc.driver.oracle.version}</version>
<scope>runtime</scope>
</dependency>
其他的其他的依赖包的方式和上面的一样,下面是我需要的包
# 安装sqljdbc4
mvn install:install-file -DgroupId=com.microsoft.sqlserver -DartifactId=sqljdbc4 -Dversion=4.0 -Dpackaging=jar -Dfile=sqljdbc4-4.0.jar
# 安装hessian
mvn install:install-file -DgroupId=com.hession -DartifactId=hessian -Dversion=3.1.5 -Dpackaging=jar -Dfile=hessian-3.1.5.jar
# 安装hessionweb
mvn install:install-file -DgroupId=com.hessionweb -DartifactId=hessionweb -Dversion=3.2 -Dpackaging=jar -Dfile=hessionweb-3.2.jar
# 安装pinyin4j
mvn install:install-file -DgroupId=net.sourceforge.pinyin4j -DartifactId=pinyin4j -Dversion=2.5.0 -Dpackaging=jar -Dfile=pinyin4j-2.5.0.jar
下面是需要的依赖文件
https://github.com/Jonyker/Java-Grammar/tree/master/libs_maven
网友评论