[英]Maven Dependency Plugin go-offline not downloading some plugins
I am trying to download all transitive dependencies and plugins for a pom file into a local folder and then using it to run sonarqube offline. 我试图将pom文件的所有传递依赖项和插件下载到本地文件夹,然后使用它来运行sonarqube离线。 I am fairly new to Maven, so I might be doing something wrong here, but I think maven maven-dependency-plugin:3.1.1:go-offline is not downloading all plugins needed to run sonarqube, which is causing an error.
我对Maven相当新,所以我可能在这里做错了,但我认为maven maven-dependency-plugin:3.1.1:go-offline不会下载运行sonarqube所需的所有插件,这会导致错误。
This is what I have tried. 这就是我尝试过的。
mvn -D"maven.repo.local"="c:\\test\\test" org.apache.maven.plugins:maven-dependency-plugin:3.1.1:go-offline
mvn -o -D"maven.repo.local"="c:\\test\\test" sonar:sonar
This however gives me the following error 但是这给了我以下错误
[INFO] Scanning for projects...
[WARNING] The POM for org.apache.maven.plugins:maven-antrun-plugin:jar:1.3 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-antrun-plugin:1.3: Plugin org.apache.maven.plugins:maven-antrun-plugin:1.3 or one of its dependencies could not be resolved: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.apache.maven.plugins:maven-antrun-plugin:jar:1.3 has not been downloaded from it before.
[WARNING] The POM for org.apache.maven.plugins:maven-assembly-plugin:jar:2.2-beta-5 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5: Plugin org.apache.maven.plugins:maven-assembly-plugin:2.2-beta-5 or one of its dependencies could not be resolved: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.apache.maven.plugins:maven-assembly-plugin:jar:2.2-beta-5 has not been downloaded from it before.
[WARNING] The POM for org.apache.maven.plugins:maven-dependency-plugin:jar:2.8 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-dependency-plugin:2.8: Plugin org.apache.maven.plugins:maven-dependency-plugin:2.8 or one of its dependencies could not be resolved: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.apache.maven.plugins:maven-dependency-plugin:jar:2.8 has not been downloaded from it before.
[WARNING] The POM for org.apache.maven.plugins:maven-release-plugin:jar:2.5.3 is missing, no dependency information available
[WARNING] Failed to retrieve plugin descriptor for org.apache.maven.plugins:maven-release-plugin:2.5.3: Plugin org.apache.maven.plugins:maven-release-plugin:2.5.3 or one of its dependencies could not be resolved: Cannot access central (https://repo.maven.apache.org/maven2) in offline mode and the artifact org.apache.maven.plugins:maven-release-plugin:jar:2.5.3 has not been downloaded from it before.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.133 s
[INFO] Finished at: 2019-04-30T14:35:43+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'sonar' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (c:\test\test), 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/NoPluginFoundForPrefixException
The POM file is as below POM文件如下
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>HelloWorld</groupId>
<artifactId>HelloWorld_Test</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.6.0.1398</version>
</dependency>
</dependencies>
</project>
Since it is complaining about various plugins not being available, I gather there is a problem with the maven-dependency-plugin not downloading all necessary plugins needed to run sonarqube ? 由于它抱怨各种插件不可用,我收集maven-dependency-plugin有问题没有下载运行sonarqube所需的所有必要插件? Any ideas how to get around this?
任何想法如何解决这个问题?
sonar-maven-plugin
should be declared as a plugin and not as a dependency. sonar-maven-plugin
应该被声明为插件而不是依赖。
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.sonarsource.scanner.maven</groupId>
<artifactId>sonar-maven-plugin</artifactId>
<version>3.6.0.1398</version>
</plugin>
</plugins>
</pluginManagement>
</build>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.