【发布时间】:2016-07-29 01:26:09
【问题描述】:
我有一个 Maven 项目,它生成一个用于 Web 服务的 jar 文件。它具有使用jetty-maven-plugin 运行的集成测试。
为了在编译后的 jar 文件上运行集成测试,我必须使用 <systemPath>${project.build.directory}/${project.build.finalName}.${project.packaging}</systemPath> 创建一个依赖项。集成测试如我所愿运行,使用编译后的 jar 文件并从 src/test 目录中正确创建 Web 应用程序。
所以就这个项目构建而言,这个设置非常有效。
问题是发布过程中部署的POM文件仍然有systemPath的依赖。这意味着使用 jar 的项目在构建期间报告错误。该错误表明 jar 文件“必须指定绝对路径”。这些构建不会失败,但日志混乱且具有误导性。
我希望从部署到我们的 Maven 存储库的 POM 中删除此 systemPath。我们该怎么做?
作为参考,这里是项目 POM 的相关部分。
<build>
<plugins>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.0.7.v20131107</version>
<configuration>
<webAppSourceDirectory>${project.basedir}/src/test/webapp</webAppSourceDirectory>
<classesDirectory>${project.build.testSourceDirectory}</classesDirectory>
<useTestClasspath>true</useTestClasspath>
</configuration>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<scope>system</scope>
<systemPath>${project.build.directory}/${project.build.finalName}.${project.packaging}</systemPath>
</dependency>
</dependencies>
<executions>
<execution>
<id>start-jetty</id>
<phase>pre-integration-test</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<scanIntervalSeconds>0</scanIntervalSeconds>
<daemon>true</daemon>
</configuration>
</execution>
<execution>
<id>stop-jetty</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
【问题讨论】:
标签: maven maven-3 maven-jetty-plugin maven-deploy-plugin