[英]BUILD FAILURE in maven
我正在嘗試使用 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 install 正確構建 new-webapp 項目,每當我這樣做時,它總是給我上述錯誤。
對此的任何幫助將不勝感激!!! 謝謝。
更新:-
我剛剛檢查了我的 pom。 測試邏輯項目沒有任何 cobertura 的東西..
只有我的父 pom.xml 有 cobertura 東西,它有兩個模塊 adeed,一個用於new-webapp
,另一個用於logic
。 下面是我的 pom.xml 文件 -
<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
。 但是,請嘗試使用以下參數運行mvn
: -DcoberturaHaltOnError=false
由於測試覆蓋率不足,構建沒有成功。 減少下面標簽中提到的測試覆蓋率並嘗試。
85 & lineRate>85
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.