我正在尝试使用maven构建我的new-webapp
模块,每当我使用cygwin从命令提示符执行mvn install
时,它会给我这个错误 -
$ mvn install
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building new-webapp MAIN
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.parent:test-logic:jar:MAIN is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.404s
[INFO] Finished at: Tue Nov 19 22:19:10 PST 2013
[INFO] Final Memory: 4M/243M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project new-webapp: Could not resolve dependencies for project com.parent:new-webapp:jar:MAIN: Failure to find com.parent:test-logic:jar:MAIN in http://caucho.com/m2-snapshot was cached in the local repository, resolution will not be reattempted until the update interval of caucho.maven-repo has elapsed or updates are forced -> [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
这个new-webapp
模块依赖于更多依赖项,并且从上面的错误中我发现我需要构建 - com.parent:test-logic:jar
依赖项,然后我才能构建我的new-webapp
所以我想,我需要先在com.parent:test-logic:jar
mvn install
上new-webapp
之前构建该依赖关系(test-logic
)。所以我去了我的mvn install
项目,我运行了相同的命令[INFO] Cobertura 1.9.4.1 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 247 classes.
[ERROR] com.parent.logic.exception.AlreadyLockedException failed check. Line coverage rate of 0.0% is below 80.0%
com.parent.logic.util.LuaUtil$1 failed check. Line coverage rate of 0.0% is below 80.0%
com.parent.logic.dao.impl.UrlDAOReadOnlyImpl failed check. Branch coverage rate of 0.0% is below 90.0%
com.parent.logic.dao.impl.UrlDAOReadOnlyImpl failed check. Line coverage rate of 0.0% is below 80.0%
com.parent.logic.service.CronService failed check. Branch coverage rate of 0.0% is below 90.0%
com.parent.logic.service.CronService failed check. Line coverage rate of 0.0% is below 80.0%
com.parent.logic.msg.client.AppStoreResponse failed check. Branch coverage rate of 0.0% is below 90.0%
----- some other errors like this
Project failed check. Total branch coverage rate of 0.0% is below 85.0%
Project failed check. Total line coverage rate of 0.0% is below 85.0%
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.424s
[INFO] Finished at: Tue Nov 19 22:18:42 PST 2013
[INFO] Final Memory: 23M/249M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:cobertura-maven-plugin:2.5.2:check (default) on project mac-core: Coverage check failed. See messages above. -> [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/MojoFailureException
,这次我得到了不同的错误,我不知道如何解决这个错误 -
test-logic
这与某些cobertura maven插件错误有关。我的mvn install
项目正在使用cobertura插件。那么在对test-logic
项目进行test-logic
时是否有任何方法,我可以跳过所有这些cobertura事项并test-logic
项目正确构建?
如果需要,我也可以为test-logic
项目提供pom.xml文件。如果我可以正确构建这个new-webapp
项目,那么我也可以构建new-weabapp项目。
我的主要目标是使用mvn install正确构建new-webapp项目,每当我这样做时,它总是给我上面提到的错误。
对此的任何帮助都会非常感激!!! 感谢。
更新: -
我刚检查过我的pom。测试逻辑项目没有任何cobertura事情..
只有我的父pom.xml有cobertura的东西,它有两个模块,一个用于logic
,另一个用于<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.parent</groupId>
<artifactId>test-parent</artifactId>
<version>MAIN</version>
<packaging>pom</packaging>
<name>Host-PC</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<release.version>MAIN</release.version>
<cobertura.version>1.9.4</cobertura.version>
</properties>
<modules>
<module>logic</module>
<module>new-webapp</module>
</modules>
<pluginRepositories>
<pluginRepository>
<id>caucho</id>
<name>Caucho</name>
<url>http://caucho.com/m2-snapshot</url>
</pluginRepository>
</pluginRepositories>
<repositories>
<repository>
<id>caucho.maven-repo</id>
<name>Caucho Repository</name>
<url>http://caucho.com/m2-snapshot</url>
</repository>
<repository>
<id>java.net-Public</id>
<name>Maven Java Net Snapshots and Releases</name>
<url>https://maven.java.net/content/groups/public/</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.caucho</groupId>
<artifactId>resin</artifactId>
<version>4.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.caucho</groupId>
<artifactId>resin-javaee</artifactId>
<version>4.0-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.xml.bind</groupId>
<artifactId>jaxb-api</artifactId>
<version>2.2.4</version>
</dependency>
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>2.2.4-1</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>12.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.0.13</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.parent</groupId>
<artifactId>test-logic</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<profiles>
<profile>
<id>cobertura-instrument</id>
<activation>
<property>
<name>cobertura-build</name>
</property>
</activation>
<modules>
<module>test-cobertura</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.2</version>
<configuration>
</configuration>
<executions>
<execution>
<id>instrument-code</id>
<phase>process-classes</phase>
<goals>
<goal>instrument</goal>
</goals>
<configuration>
<attach>true</attach>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<inherited>true</inherited>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>net.sourceforge.cobertura</groupId>
<artifactId>cobertura-runtime</artifactId>
<version>${cobertura.version}</version>
<scope>provided</scope>
<type>pom</type>
</dependency>
</dependencies>
</profile>
</profiles>
<build>
<finalName>test-${project.version}-r${buildNumber}</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.2</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
<configuration>
<useLastCommittedRevision>true</useLastCommittedRevision>
<scmDirectory>${project.parent.basedir}</scmDirectory>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.6</version>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-resources</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<supportedProjectTypes>
<supportedProjectType>jar</supportedProjectType>
<supportedProjectType>bundle</supportedProjectType>
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
<instructions>
<Build-version>${buildNumber}</Build-version>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<instrumentation>
<includes>
<include>com/parent/**/*.class</include>
</includes>
<!--
<ignores>
<ignore>com.example.boringcode.*</ignore>
</ignores>
-->
<!--
<excludes>
<exclude>com/example/dullcode/**/*.class</exclude>
<exclude>com/example/**/*Test.class</exclude>
</excludes>
-->
</instrumentation>
<check>
<branchRate>85</branchRate>
<lineRate>85</lineRate>
<haltOnFailure>true</haltOnFailure>
<totalBranchRate>85</totalBranchRate>
<totalLineRate>85</totalLineRate>
<packageLineRate>85</packageLineRate>
<packageBranchRate>85</packageBranchRate>
<regexes>
<regex>
<pattern>com.parent.*</pattern>
<branchRate>90</branchRate>
<lineRate>80</lineRate>
</regex>
</regexes>
</check>
</configuration>
<executions>
<execution>
<goals>
<goal>clean</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.codehause.mojo</groupId>
<artifactId>codertura-maven-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<formats>
<format>html</format>
<format>xml</format>
</formats>
</configuration>
</plugin>
</plugins>
</reporting>
</project>
。下面是我的pom.xml文件 -
{{1}}
答案 0 :(得分:0)
由于您未提供pom.xml
,因此可能无法立即生效。但是,请尝试使用以下参数运行mvn
:-DcoberturaHaltOnError=false
答案 1 :(得分:0)
由于测试覆盖率不足,构建不成功。减少以下标签中提到的测试覆盖率并尝试。
85&amp;线速&加热至85