我尝试使用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
。
所以我想,在我的new-webapp
上执行mvn install
之前,我需要先构建依赖关系(com.parent:test-logic:jar
)。所以我转到我的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
这与一些cobertura maven插件错误有关。我的test-logic
项目正在使用cobertura插件。所以有没有办法在test-logic
项目上做mvn install
的时候,我可以跳过所有这些cobertura的东西,test-logic
项目得到正确的构建?
如果需要,我也可以为test-logic
项目提供pom.xml文件。如果我可以正确地构建这个test-logic
项目,那么我也可以构建new-weabapp项目。
我的主要目标是使用mvn安装正确地构建新的webapp项目,每当我这样做的时候,它总是给我上面提到的错误。
在这方面的任何帮助都将非常感激!!谢谢。
更新日期:-
我刚检查了我的pom.测试逻辑项目没有任何cobertura的东西。
只有我的父pom.xml有cobertura的东西,它有两个模块,一个用于new-webapp
,另一个用于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>
2条答案
按热度按时间0dxa2lsx1#
由于您没有提供
pom.xml
,因此可能无法立即运行。但是,请尝试使用以下参数运行mvn
:-DcoberturaHaltOnError=false
xytpbqjk2#
由于测试覆盖率不足,生成未成功。请减小以下标记中提到的测试覆盖率,然后重试。
85 &线路价格〉85