首先,围绕这个主题有很多帖子,但我没有解决这个问题。
我有自己的maven存储库,并且由于组织安全合规性,很难将新jar带入其中。
我正在寻找的是从插件中排除jar并在插件中添加可用的依赖项。请建议所需的配置?
目前项目构建失败,因为缺少一些必需的罐子。
POM -
<dependencies>
<dependency>
<groupId>org.apache.mrunit</groupId>
<artifactId>mrunit</artifactId>
<version>1.1.0</version>
<classifier>hadoop2</classifier>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.4</version>
<scope>test</scope>
</dependency></dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine>
<!-- ${argLine} -->
<suiteXmlFiles> <suiteXmlFile>${project.basedir}/src/test/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<debugForkedProcess>true</debugForkedProcess>
<!-- <skip>true</skip>-->
</configuration>
</plugin>
</plugins>
</build>
构建错误:
[WARNING] Missing POM for org.apache.maven.surefire:surefire-testng:jar:2.18.1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.055s
[INFO] Finished at: Mon Aug 15 11:50:31 MST 2016
[INFO] Final Memory: 62M/363M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project cxp: Unable to generate classpath: org.apache.maven.artifact.resolver.MultipleArtifactsNotFoundException: Missing:
[ERROR] ----------
[ERROR] 1) org.apache.maven.surefire:surefire-testng:jar:2.18.1
[ERROR]
[ERROR] Try downloading the file manually from the project website.
[ERROR]
[ERROR] Then, install it using the command:
[ERROR] mvn install:install-file -DgroupId=org.apache.maven.surefire -DartifactId=surefire-testng -Dversion=2.18.1 -Dpackaging=jar -Dfile=/path/to/file
[ERROR]
[ERROR] Alternatively, if you host your own repository you can deploy the file there:
[ERROR] mvn deploy:deploy-file -DgroupId=org.apache.maven.surefire -DartifactId=surefire-testng -Dversion=2.18.1 -Dpackaging=jar -Dfile=/path/to/file -Durl=[url] -DrepositoryId=[id]
[ERROR]
[ERROR] Path to dependency:
[ERROR] 1) dummy:dummy:jar:1.0
[ERROR] 2) org.apache.maven.surefire:surefire-testng:jar:2.18.1
[ERROR]
[ERROR] ----------
[ERROR] 1 required artifact is missing.
[ERROR]
[ERROR] for artifact:
[ERROR] dummy:dummy:jar:1.0
[ERROR]
[ERROR] from the specified remote repositories:
[ERROR] prod ****************************************************, releases=true, snapshots=true)
[ERROR] -> [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/MojoExecutionException
Process finished with exit code 1
我在存储库中有org.apache.maven.surefire:surefire-testng:jar:2.12.4
所以我修改了插件以及下面的更改,但是maven仍然会抛出相同的错误。
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.18.1</version>
<configuration>
<argLine>-Xmx1024m -XX:MaxPermSize=256m</argLine> <!-- ${argLine} -->
<suiteXmlFiles>
<suiteXmlFile>${project.basedir}/src/test/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<debugForkedProcess>true</debugForkedProcess>
<!-- <skip>true</skip>-->
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>2.12.4</version>
</dependency>
</dependencies>
</plugin>