TA的每日心情 | 擦汗 3 天前 |
---|
签到天数: 527 天 连续签到: 4 天 [LV.9]测试副司令
|
1测试积点
用maven搭配sonar进行代码检查,在pom中配置好了需要的插件和版本号之后,运行,进入.m2/repository中查看,能够看到相应的插件目录已经下载了这个jar包,但是还是会到网上连接maven的中央仓库,而且提示无法找到相关的插件包,上maven的中央仓库中查看,是有这个插件的,相应的版本也有。
打印的异常信息和电脑中相关的插件如下所示:
我需要的一个插件是maven-compiler-plugin,groupId=org.apache.maven.plugins,artifactId=maven-compiler-plugin,version=2.3.2
pom文件里面书写如下:
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <version>2.3.2</version>
- dependencies>
- <dependency>
- <groupId>org.codehaus.plexus</groupId>
- <artifactId>plexus-complier-javac</artifactId>
- <version>1.8.1</version>
- </dependency>
- </dependencies>
复制代码 而且我的本地仓库中有这个插件,如下:
- :~/.m2/repository/org/apache/maven/plugins$ ls
- maven-android-plugin maven-metadata-central.xml.sha1
- maven-archetype-plugin maven-mojo-plugin
- maven-assembly-plugin maven-plugins
- maven-checkstyle-plugin maven-pmd-plugin
- maven-clean-plugin maven-project-info-reports-plugin
- maven-compiler-plugin maven-resources-plugin
- maven-install-plugin maven-site-plugin
- maven-jar-plugin maven-surefire-plugin
- maven-metadata-central.xml
- :~/.m2/repository/org/apache/maven/plugins$ cd maven-compiler-plugin/
- :~/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin$ ls
- 2.0.2 2.3.1 2.3.2 maven-metadata-local.xml
- :~/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin$ cd 2.3.2
- :~/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin/2.3.2$ ls
- maven-compiler-plugin-2.3.2.jar maven-compiler-plugin-2.3.2.jar.sha1 maven-compiler-plugin-2.3.2.pom maven-compiler-plugin-2.3.2.pom.sha1
复制代码 另一个插件plexus-compiler-javac也有,版本号是1.8.1,
- groupId=org.codehaus.plexus artifacId=plexus-compiler-javac
- plexus plexus-compiler-api plexus-complier-javac
- plexus-container-default plexus-interactivity plexus-resources plexus-archiver plexus-compiler-javac plexus-component-annotations plexus-containers
- plexus-interactivity-api plexus-utils plexus-classworlds plexus-compiler-manager plexus-component-api plexus-digest
- plexus-interpolation plexus-velocity plexus-compiler plexus-compilers
- plexus-components plexus-i18n plexus-io
- :~/.m2/repository/org/codehaus/plexus$ cd plexus-compiler-javac
- :~/.m2/repository/org/codehaus/plexus/plexus-compiler-javac$ ls
- 1.5.3 1.8 1.8.1 maven-metadata-local.xml
- :~/.m2/repository/org/codehaus/plexus/plexus-compiler-javac$ cd 1.8.1
- :~/.m2/repository/org/codehaus/plexus/plexus-compiler-javac/1.8.1$ ls
- plexus-compiler-javac-1.8.1.jar plexus-compiler-javac-1.8.1.jar.sha1 plexus-compiler-javac-1.8.1.pom plexus-compiler-javac-1.8.1.pom.sha1
复制代码 运行mvn clean install sonar:sonar的时候就会出错,部分错误信息如下:
- [INFO] skip non existing resourceDirectory /home/kes/froyo/src/main/resources
- Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-complier-javac/1.8.1/plexus-complier-javac-1.8.1.pom
- [INFO] Unable to find resource 'org.codehaus.plexus:plexus-complier-javac:pom:1.8.1' in repository central (http://repo1.maven.org/maven2)
- Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-complier-javac/1.8.1/plexus-complier-javac-1.8.1.pom
- [INFO] Unable to find resource 'org.codehaus.plexus:plexus-complier-javac:pom:1.8.1' in repository central (http://repo1.maven.org/maven2)
- Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-complier-javac/1.8.1/plexus-complier-javac-1.8.1.jar
- [INFO] Unable to find resource 'org.codehaus.plexus:plexus-complier-javac:jar:1.8.1' in repository central (http://repo1.maven.org/maven2)
- Downloading: http://repo1.maven.org/maven2/org/codehaus/plexus/plexus-complier-javac/1.8.1/plexus-complier-javac-1.8.1.jar
- [INFO] Unable to find resource 'org.codehaus.plexus:plexus-complier-javac:jar:1.8.1' in repository central (http://repo1.maven.org/maven2)
- [INFO] ------------------------------------------------------------------------
- [ERROR] BUILD ERROR
- [INFO] ------------------------------------------------------------------------
- [INFO] Failed to resolve artifact.
- Missing:
- ----------
- 1) org.codehaus.plexus:plexus-complier-javac:jar:1.8.1
- Try downloading the file manually from the project website.
- Then, install it using the command:
- mvn install:install-file -DgroupId=org.codehaus.plexus -DartifactId=plexus-complier-javac -Dversion=1.8.1 -Dpackaging=jar -Dfile=/path/to/file
- Alternatively, if you host your own repository you can deploy the file there:
- mvn deploy:deploy-file -DgroupId=org.codehaus.plexus -DartifactId=plexus-complier-javac -Dversion=1.8.1 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
- Path to dependency:
- 1) org.apache.maven.plugins:maven-compiler-plugin:maven-plugin:2.3.2
- 2) org.codehaus.plexus:plexus-complier-javac:jar:1.8.1
- ----------
- 1 required artifact is missing.
- for artifact:
- org.apache.maven.plugins:maven-compiler-plugin:maven-plugin:2.3.2
- from the specified remote repositories:
- central (http://repo1.maven.org/maven2),
- apache.snapshots (http://repository.apache.org/snapshots)
复制代码 错误信息大体是说不能从中央仓库中找到那两个插件,但是我的repository上是有的,而且maven的中央仓库网站上也有这个,请众兄弟看看是哪里出了问题。
|
|