i try to generate wsdl file using jaxws maven plugin
finaly:"successfully building" but my wsdl file is not generate, it is normaly in the folder \target\surefire-reports
but i don't have it after the building
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building BSCSwebservices Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.sun.xml.stream.buffer:streambuffer:jar:0.4 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[WARNING] The POM for org.jvnet.staxex:stax-ex:jar:1.0 is invalid, transitive dependencies (if any) will not be available, enable debug logging for more details
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # BSCSwebservices ---
[debug] execute contextualize
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 6 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # BSCSwebservices ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # BSCSwebservices ---
[debug] execute contextualize
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory C:\Users\sayed\workspace\BSCSwebservices\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # BSCSwebservices ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.10:test (default-test) # BSCSwebservices ---
[INFO] Surefire report directory: C:\Users\sayed\workspace\BSCSwebservices\target\surefire-reports
T E S T S
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-war-plugin:2.1.1:war (default-war) # BSCSwebservices ---
[INFO] Packaging webapp
[INFO] Assembling webapp [BSCSwebservices] in [C:\Users\sayed\workspace\BSCSwebservices\target\BSCSwebservices]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\Users\sayed\workspace\BSCSwebservices\src\main\webapp]
[INFO] Webapp assembled in [1042 msecs]
[INFO] Building war: C:\Users\sayed\workspace\BSCSwebservices\target\BSCSwebservices.war
[WARNING] Warning: selected war files include a WEB-INF/web.xml which will be ignored
(webxml attribute is missing from war task, or ignoreWebxml attribute is specified as 'true')
[INFO]
[INFO] --- jaxws-maven-plugin:1.11:wsgen (default) # BSCSwebservices ---
warning: The apt tool and its associated API are planned to be
removed in the next major JDK release. These features have been
superseded by javac and the standardized annotation processing API,
javax.annotation.processing and javax.lang.model. Users are
recommended to migrate to the annotation processing features of
javac; see the javac man page for more information.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1:30.437s
[INFO] Finished at: Fri Aug 02 23:00:03 WAT 2013
[INFO] Final Memory: 16M/40M
[INFO] ------------------------------------------------------------------------
this a part of pom.xml
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxws-maven-plugin</artifactId>
<version>1.11</version>
<executions>
<execution>
<configuration>
<sei>com.ws.BillingAccountRead</sei>
<genwsdl>true</genwsdl>
<keep>true</keep>
</configuration>
<phase>package</phase>
<goals>
<goal>wsgen</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
when i use mvn clean package -X
<configuration>
<destDir default-value="${project.build.outputDirectory}"/>
<extension default-value="false"/>
<genWsdl default-value="false"/>
<keep default-value="false">true</keep>
<pluginArtifactMap>${plugin.artifactMap}</pluginArtifactMap>
<pluginArtifacts>${plugin.artifacts}</pluginArtifacts>
<project>${project}</project>
<resourceDestDir default-value="${project.build.directory}/jaxws/wsgen/wsdl"/>
<sei>com.ws.BillingAccountRead</sei>
<verbose default-value="false">true</verbose>
</configuration>
I would think you would want to build the wsdl in the 'generate-sources' phase or maybe 'generate-resources' instead of 'package'
It is supposed to generate the wsdl in ${resourceDestDir}
Configure it like below with verbose = true, and execute the mvn command with -X flag, then look the maven log carefully.
<executions>
<execution>
<configuration>
<sei>com.ws.BillingAccountRead</sei>
<genwsdl>true</genwsdl>
<keep>true</keep>
<verbose>true</verbose>
</configuration>
<phase>package</phase>
<goals>
<goal>wsgen</goal>
</goals>
</execution>
</executions>
Try to build using -X or -e to get more info from the log
Related
All my tests are located in src/test/java/... with java marked as a test source folder. They are also all named as ***Test so Surefire plugin should be finding them.
However my maven verify fails as all my test coverage is at 0%. I have 20 tests which should cover all of my non-excluded classes and they all pass when I do run them in my IntelliJ. When I run maven test or maven verify my tests aren't being run. I'm not sure why.
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.8.6</version>
<executions>
<execution>
<id>default-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>default-report</id>
<goals>
<goal>report</goal>
</goals>
</execution>
<execution>
<id>jacoco-check</id>
<goals>
<goal>check</goal>
</goals>
<configuration>
<excludes>
...
</excludes>
<rules>
<rule>
<element>CLASS</element>
<limits>
<limit>
<counter>LINE</counter>
<value>COVEREDRATIO</value>
<minimum>80%</minimum>
</limit>
<limit>
<counter>BRANCH</counter>
<value>COVEREDRATIO</value>
<minimum>80%</minimum>
</limit>
</limits>
</rule>
</rules>
</configuration>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
----------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.6:prepare-agent (default-prepare-agent) # *-*-service ---
[INFO] surefireArgLine set to "-javaagent:C:\\Users\\*\\.m2\\repository\\org\\jacoco\\org.jacoco.agent\\0.8.6\\org.jacoco.agent-0.8.6-runtime.jar=destfile=C:\\Users\\*\\OneDrive\\Documents\\IntelliJ Projects\\*-*-service\\*-*-service\\target\\jacoco.exec,append=true"
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) # *-*-service ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # *-*-service ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) # *-*-service ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory C:\Users\*\OneDrive\Documents\IntelliJ Projects\*-*-service\*-*-service\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) # *-*-service ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) # *-*-service ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[ERROR] Java HotSpot(TM) 64-Bit Server VM warning: Options -Xverify:none and -noverify were deprecated in JDK 13 and will likely be removed in a future release.
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.6:report (report) # *-*-service ---
[INFO] Loading execution data file C:\Users\*\OneDrive\Documents\IntelliJ Projects\*-*-service\*-*-service\target\jacoco.exec
[INFO] Analyzed bundle '*-*-service' with 19 classes
[INFO]
[INFO] --- maven-jar-plugin:3.2.0:jar (default-jar) # *-*-service ---
[INFO]
[INFO] --- spring-boot-maven-plugin:2.4.4:repackage (repackage) # *-*-service ---
[INFO] Replacing main artifact with repackaged archive
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.6:report (default-report) # *-*-service ---
[INFO] Loading execution data file C:\Users\*\OneDrive\Documents\IntelliJ Projects\*-*-service\*-*-service\target\jacoco.exec
[INFO] Analyzed bundle '*-*-service' with 19 classes
[INFO]
[INFO] --- jacoco-maven-plugin:0.8.6:check (jacoco-check) # *-*-service ---
[INFO] Loading execution data file C:\Users\*\OneDrive\Documents\IntelliJ Projects\*-*-service\*-*-service\target\jacoco.exec
[INFO] Analyzed bundle '*-*-service' with 6 classes
[WARNING] Rule violated for class com.*.**.mapper.*Mapper: lines covered ratio is 0.00, but expected minimum is 0.80
[WARNING] Rule violated for class com.*.**.mapper.*Mapper: branches covered ratio is 0.00, but expected minimum is 0.80
[WARNING] Rule violated for class com.*.**.mapper.*Mapper: lines covered ratio is 0.00, but expected minimum is 0.80
[WARNING] Rule violated for class com.*.**.controller.*Controller: lines covered ratio is 0.00, but expected minimum is 0.80
[WARNING] Rule violated for class com.*.**.controller.*Controller: lines covered ratio is 0.00, but expected minimum is 0.80
[WARNING] Rule violated for class com.*.**.service.*Service: lines covered ratio is 0.00, but expected minimum is 0.80
[WARNING] Rule violated for class com.*.**.service.*Service: lines covered ratio is 0.00, but expected minimum is 0.80
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.388 s
[INFO] Finished at: 2021-04-11T19:48:54+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jacoco:jacoco-maven-plugin:0.8.6:check (jacoco-check) on project *-*-service: Coverage checks have not been met. See log for details. -> [Help 1]
I am using IntelliJ-IDEA ultimate version 2021.1 (Latest at post date )
Any help on getting my tests recognised in a full maven build would be greatly appreciated. Thanks
Please read the log, and check [ERROR].
You are using JDK 13 and some POM added -Xverify:none and -noverify in the configuration parameter argLine.
frontend-maven-plugin is getting executed twice when i issue the followign command -
mvn clean install package -DenvType=local2
My pom.xml -
<?xml version="1.0" encoding="UTF-8"?>
<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.awpl</groupId>
<artifactId>pva-nb-uw-ui</artifactId>
<packaging>war</packaging>
<version>0.2.0</version>
<profiles>
<profile>
<id>local</id>
<activation>
<property>
<name>envType</name>
<value>local</value>
</property>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<envType>local</envType>
</properties>
</profile>
<profile>
<id>local2</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<envType>local2</envType>
</properties>
</profile>
<profile>
<id>dev</id>
<activation>
<property>
<name>envType</name>
<value>dev</value>
</property>
</activation>
<properties>
<envType>dev</envType>
</properties>
</profile>
<profile>
<id>sit</id>
<activation>
<property>
<name>envType</name>
<value>sit</value>
</property>
</activation>
<properties>
<envType>sit</envType>
</properties>
</profile>
<profile>
<id>uat</id>
<activation>
<property>
<name>envType</name>
<value>uat</value>
</property>
</activation>
<properties>
<envType>uat</envType>
</properties>
</profile>
</profiles>
<build>
<finalName>pva-ui-webapp</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.4</version>
<!-- <configuration> <installDirectory>target</installDirectory>
</configuration> -->
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<nodeVersion>v6.10.0</nodeVersion>
<npmVersion>3.10.10</npmVersion>
</configuration>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>bower install</id>
<goals>
<goal>bower</goal>
</goals>
<configuration>
<arguments>install</arguments>
</configuration>
</execution>
<execution>
<id>gulp build</id>
<goals>
<goal>gulp</goal>
</goals>
<phase>generate-resources</phase>
<configuration>
<arguments>optimize --env ${envType}</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
The output of the command --
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building artifactname 0.2.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # artifactname ---
[INFO] Deleting D:\Softwares\workspace_eclipse\artifactname\target
[INFO]
[INFO] --- frontend-maven-plugin:1.4:install-node-and-npm (install node and npm) # artifactname ---
[INFO] Node v6.10.0 is already installed.
[INFO] NPM 3.10.10 is already installed.
[INFO]
[INFO] --- frontend-maven-plugin:1.4:npm (npm install) # artifactname ---
[INFO] Running 'npm install' in D:\Softwares\workspace_eclipse\artifactname
[WARNING] npm WARN artifactname#0.2.0 No repository field.
[INFO]
[INFO] --- frontend-maven-plugin:1.4:bower (bower install) # artifactname ---
[INFO] Running 'bower install' in D:\Softwares\workspace_eclipse\artifactname
[INFO]
[INFO] --- frontend-maven-plugin:1.4:gulp (gulp build) # artifactname ---
[INFO] Running 'gulp optimize --env local2' in D:\Softwares\workspace_eclipse\artifactname
[INFO] [10:50:06] Using gulpfile D:\Softwares\workspace_eclipse\artifactname\gulpfile.js
[INFO] [10:50:06] Starting 'lintjs'...
[INFO] [10:50:06] Analyzing JS files
[INFO] [10:50:06] Starting 'linthtml'...
[INFO] [10:50:06] Analyzing HTML files
[INFO] [10:50:06] Starting 'lintcss'...
[INFO] [10:50:06] Analyzing CSS files
[INFO] [10:50:06] Starting 'lintjson'...
[INFO] [10:50:06] Analyzing JSON files
[INFO] [10:50:06] Starting 'clean'...
[INFO] [10:50:06] cleaning ./src/main/webapp/js/,./src/main/webapp/fonts/,./src/main/webapp/resources/,./src/main/webapp/styles/,./src/main/webapp/index.html,./src/main/webapp/rev-manifest.json,./.tmp/
[ERROR] The rule `angular/service-name` will be split up to different rules in the next version. Please read the docs for more information
[INFO] [10:50:07] Finished 'clean' after 1.13 s
[INFO] [10:50:07] Starting 'jsoncopy'...
[INFO] [10:50:07] copying and minifying json resources
[INFO] [10:50:10] Finished 'lintcss' after 3.37 s
[INFO] [10:51:12] Finished 'lintjson' after 1.1 min
[INFO] [10:51:13] Finished 'jsoncopy' after 1.08 min
[INFO] [10:51:13] Starting 'htmlcopy'...
[INFO] [10:51:13] copying html files for making it ready for templatecache
[INFO] [10:51:14] Finished 'linthtml' after 1.12 min
[INFO] [10:51:16] Finished 'lintjs' after 1.17 min
[INFO] [10:51:16] Starting 'wireindex'...
[INFO] [10:51:16] Linking all js/css files into index.html
[INFO] [10:51:17] gulp-inject 100 files into index.html.
[INFO] [10:51:17] gulp-inject 3 files into index.html.
[INFO] [10:51:17] Finished 'wireindex' after 705 ms
[INFO] [10:51:17] Finished 'htmlcopy' after 3.21 s
[INFO] [10:51:17] Starting 'fontscopy'...
[INFO] [10:51:17] copying bootstrap and other fonts
[INFO] [10:51:17] Finished 'fontscopy' after 224 ms
[INFO] [10:51:17] Starting 'templatecache'...
[INFO] [10:51:17] creating AngularJS $templateCache
[INFO] [10:51:18] Finished 'templatecache' after 824 ms
[INFO] [10:51:18] Starting 'optimize'...
[INFO] [10:51:18] optimizing the js/html/css files
[INFO] [10:51:19] gulp-inject 1 files into index.html.
[INFO] [10:51:31] Finished 'optimize' after 13 s
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # artifactname ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Softwares\workspace_eclipse\artifactname\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) # artifactname ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # artifactname ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Softwares\workspace_eclipse\artifactname\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) # artifactname ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # artifactname ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) # artifactname ---
[INFO] Packaging webapp
[INFO] Assembling webapp [artifactname] in [D:\Softwares\workspace_eclipse\artifactname\target\pva-ui-webapp]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\Softwares\workspace_eclipse\artifactname\src\main\webapp]
[INFO] Webapp assembled in [600 msecs]
[INFO] Building war: D:\Softwares\workspace_eclipse\artifactname\target\pva-ui-webapp.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO]
[INFO] --- maven-install-plugin:2.4:install (default-install) # artifactname ---
[INFO] Installing D:\Softwares\workspace_eclipse\artifactname\target\pva-ui-webapp.war to C:\Users\Admin\.m2\repository\com\mycompany\artifactname\0.2.0\artifactname-0.2.0.war
[INFO] Installing D:\Softwares\workspace_eclipse\artifactname\pom.xml to C:\Users\Admin\.m2\repository\com\mycompany\artifactname\0.2.0\artifactname-0.2.0.pom
[INFO]
[INFO] --- frontend-maven-plugin:1.4:install-node-and-npm (install node and npm) # artifactname ---
[INFO] Node v6.10.0 is already installed.
[INFO] NPM 3.10.10 is already installed.
[INFO]
[INFO] --- frontend-maven-plugin:1.4:npm (npm install) # artifactname ---
[INFO] Running 'npm install' in D:\Softwares\workspace_eclipse\artifactname
[WARNING] npm WARN artifactname#0.2.0 No repository field.
[INFO]
[INFO] --- frontend-maven-plugin:1.4:bower (bower install) # artifactname ---
[INFO] Running 'bower install' in D:\Softwares\workspace_eclipse\artifactname
[INFO]
[INFO] --- frontend-maven-plugin:1.4:gulp (gulp build) # artifactname ---
[INFO] Running 'gulp optimize --env local2' in D:\Softwares\workspace_eclipse\artifactname
[INFO] [10:51:48] Using gulpfile D:\Softwares\workspace_eclipse\artifactname\gulpfile.js
[INFO] [10:51:48] Starting 'lintjs'...
[INFO] [10:51:48] Analyzing JS files
[INFO] [10:51:49] Starting 'linthtml'...
[INFO] [10:51:49] Analyzing HTML files
[INFO] [10:51:49] Starting 'lintcss'...
[INFO] [10:51:49] Analyzing CSS files
[INFO] [10:51:49] Starting 'lintjson'...
[INFO] [10:51:49] Analyzing JSON files
[INFO] [10:51:49] Starting 'clean'...
[INFO] [10:51:49] cleaning ./src/main/webapp/js/,./src/main/webapp/fonts/,./src/main/webapp/resources/,./src/main/webapp/styles/,./src/main/webapp/index.html,./src/main/webapp/rev-manifest.json,./.tmp/
[ERROR] The rule `angular/service-name` will be split up to different rules in the next version. Please read the docs for more information
[INFO] [10:51:50] Finished 'clean' after 1.05 s
[INFO] [10:51:50] Starting 'jsoncopy'...
[INFO] [10:51:50] copying and minifying json resources
[INFO] [10:51:52] Finished 'lintcss' after 3.29 s
[INFO] [10:52:56] Finished 'lintjson' after 1.12 min
[INFO] [10:52:58] Finished 'jsoncopy' after 1.12 min
[INFO] [10:52:58] Starting 'htmlcopy'...
[INFO] [10:52:58] copying html files for making it ready for templatecache
[INFO] [10:52:58] Finished 'linthtml' after 1.13 min
[INFO] [10:53:00] Finished 'lintjs' after 1.18 min
[INFO] [10:53:00] Starting 'wireindex'...
[INFO] [10:53:00] Linking all js/css files into index.html
[INFO] [10:53:01] gulp-inject 100 files into index.html.
[INFO] [10:53:01] gulp-inject 3 files into index.html.
[INFO] [10:53:01] Finished 'wireindex' after 568 ms
[INFO] [10:53:01] Finished 'htmlcopy' after 3.04 s
[INFO] [10:53:01] Starting 'fontscopy'...
[INFO] [10:53:01] copying bootstrap and other fonts
[INFO] [10:53:01] Finished 'fontscopy' after 182 ms
[INFO] [10:53:01] Starting 'templatecache'...
[INFO] [10:53:01] creating AngularJS $templateCache
[INFO] [10:53:02] Finished 'templatecache' after 805 ms
[INFO] [10:53:02] Starting 'optimize'...
[INFO] [10:53:02] optimizing the js/html/css files
[INFO] [10:53:02] gulp-inject 1 files into index.html.
[INFO] [10:53:15] Finished 'optimize' after 13 s
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # artifactname ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Softwares\workspace_eclipse\artifactname\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:compile (default-compile) # artifactname ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # artifactname ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory D:\Softwares\workspace_eclipse\artifactname\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.6.1:testCompile (default-testCompile) # artifactname ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # artifactname ---
[INFO] No tests to run.
[INFO] Skipping execution of surefire because it has already been run for this configuration
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) # artifactname ---
[INFO] Packaging webapp
[INFO] Assembling webapp [artifactname] in [D:\Softwares\workspace_eclipse\artifactname\target\pva-ui-webapp]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\Softwares\workspace_eclipse\artifactname\src\main\webapp]
[INFO] Webapp assembled in [312 msecs]
[INFO] Building war: D:\Softwares\workspace_eclipse\artifactname\target\pva-ui-webapp.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:27 min
[INFO] Finished at: 2017-07-19T10:53:15+05:30
[INFO] Final Memory: 12M/122M
[INFO] ------------------------------------------------------------------------
Notice that the frontend-maven-plugin is executed twice. This almost doubles up the build time.
How do I make it run only once?
You are getting multiple executions because you have specified multiple default lifecycle phases on the command line:
mvn clean install package -DenvType=local2
This will:
run the clean lifecycle;
run the default lifecycle up to and including install (which includes package);
run the default lifecycle again up to and including package.
Please see Introduction to the Build Lifecycle for more information.
I am trying to run following command on following project:
mvn clean package nbm:cluster nbm:run-ide
Project URL: https://github.com/mulesoft-labs/mule-netbeans (Netbeans Support for Mule)
I tried it on Apanche Maven 3.0.4 and 3.0.5 but unable to run it.
I tried it with Java 6, Java 7 and Java 8.
With Java 7 and Java 8 i am getting following issues:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] Mule Netbeans XML
[INFO] Mule Support Plugin
[INFO] Mule Tools for NetBeans
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Mule Netbeans XML 0.5
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) # mule-netbeans-xml ---
[INFO] Deleting D:\mule-netbeans-master\mule-netbeans-xml\target
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # mule-netbeans-xml ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\mule-netbeans-master\mule-netbeans-xml\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) # mule-netbeans-xml ---
[INFO] Compiling 2 source files to D:\mule-netbeans-master\mule-netbeans-xml\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] D:\mule-netbeans-master\mule-netbeans-xml\src\main\java\org\mule\tooling\netbeans\xml\UserCatalogProcessor.java:[38,37] error: cannot find symbol
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Skipping Mule Tools for NetBeans
[INFO] This project has been banned from the build due to previous failures.
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] Mule Netbeans XML ................................. FAILURE [1.471s]
[INFO] Mule Support Plugin ............................... SKIPPED
[INFO] Mule Tools for NetBeans ........................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.154s
[INFO] Finished at: Thu May 04 08:53:45 IST 2017
[INFO] Final Memory: 15M/220M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project mule-netbeans-xml: Compilation failure
[ERROR] D:\mule-netbeans-master\mule-netbeans-xml\src\main\java\org\mule\tooling\netbeans\xml\UserCatalogProcessor.java:[38,37] error: cannot find symbol
[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.
With Java 6, i am getting following:
Failure executing javac, but could not parse the error:
javac: invalid target release: 1.7
Usage: javac <options> <source files>
use -help for a list of possible options
POm.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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>org.mule.tooling.netbeans</groupId>
<artifactId>mule-netbeans</artifactId>
<name>Mule Tools for NetBeans</name>
<description>NetBeans Support for Mule</description>
<version>1.1</version>
<packaging>pom</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<netbeans-version>RELEASE82</netbeans-version>
</properties>
<licenses>
<license>
<name>Apache License 2.0</name>
<url>http://opensource.org/licenses/Apache-2.0</url>
</license>
</licenses>
<build>
<pluginManagement>
<plugins>
<plugin>
<!-- NetBeans 6.9+ requires JDK 6, starting NetBeans 7.4 source 1.7 is required -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<modules>
<!--<module>mule-netbeans-runtime</module>-->
<!--<module>mule-netbeans-api</module>-->
<!--<module>mule-netbeans-config</module>-->
<module>mule-netbeans-xml</module>
<module>mule-netbeans-plugin</module>
</modules>
<repositories>
<repository>
<id>netbeans</id>
<name>Repository hosting NetBeans modules</name>
<url>http://bits.netbeans.org/nexus/content/groups/netbeans</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
</project>
Could anyone assist where i am doing wrong?
try to change to maven2 and you have to add this additional info in the pom:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerVersion>1.5</compilerVersion>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
Done following Changes to execute it perfectly.
Java 8, Apache Maven 3.0.5
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
Output:
Scanning for projects...
------------------------------------------------------------------------
Reactor Build Order:
Mule Netbeans XML
Mule Support Plugin
Mule Tools for NetBeans
------------------------------------------------------------------------
Building Mule Netbeans XML 0.5
------------------------------------------------------------------------
--- maven-clean-plugin:2.4.1:clean (default-clean) # mule-netbeans-xml ---
Deleting D:\mule-netbeans-master\mule-netbeans-xml\target
--- maven-resources-plugin:2.5:resources (default-resources) # mule-netbeans-xml ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory D:\mule-netbeans-master\mule-netbeans-xml\src\main\resources
--- maven-compiler-plugin:2.5.1:compile (default-compile) # mule-netbeans-xml ---
Compiling 2 source files to D:\mule-netbeans-master\mule-netbeans-xml\target\classes
--- maven-resources-plugin:2.5:testResources (default-testResources) # mule-netbeans-xml ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory D:\mule-netbeans-master\mule-netbeans-xml\src\test\resources
--- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) # mule-netbeans-xml ---
No sources to compile
--- maven-surefire-plugin:2.15:test (default-test) # mule-netbeans-xml ---
Tests are skipped.
--- maven-jar-plugin:2.4:jar (default-jar) # mule-netbeans-xml ---
Building jar: D:\mule-netbeans-master\mule-netbeans-xml\target\mule-netbeans-xml-0.5.jar
--- maven-install-plugin:2.3.1:install (default-install) # mule-netbeans-xml ---
Installing D:\mule-netbeans-master\mule-netbeans-xml\target\mule-netbeans-xml-0.5.jar to C:\Users\harpreetsi\.m2\repository\org\mule\tooling\netbeans\mule-netbeans-xml\0.5\mule-netbeans-xml-0.5.jar
Installing D:\mule-netbeans-master\mule-netbeans-xml\pom.xml to C:\Users\harpreetsi\.m2\repository\org\mule\tooling\netbeans\mule-netbeans-xml\0.5\mule-netbeans-xml-0.5.pom
------------------------------------------------------------------------
Building Mule Support Plugin 0.8-SNAPSHOT
------------------------------------------------------------------------
--- maven-clean-plugin:2.4.1:clean (default-clean) # mule-netbeans-plugin ---
Deleting D:\mule-netbeans-master\mule-netbeans-plugin\target
--- maven-resources-plugin:2.6:resources (default-resources) # mule-netbeans-plugin ---
Using 'UTF-8' encoding to copy filtered resources.
Copying 39 resources
--- maven-compiler-plugin:2.5.1:compile (default-compile) # mule-netbeans-plugin ---
Compiling 63 source files to D:\mule-netbeans-master\mule-netbeans-plugin\target\classes
--- nbm-maven-plugin:4.0.1:manifest (default-manifest) # mule-netbeans-plugin ---
NBM Plugin generates manifest
Adding on module's Class-Path:
org.mule.tooling.netbeans:mule-netbeans-xml:jar:0.5
org.jdesktop:beansbinding:jar:1.2.1
--- maven-resources-plugin:2.6:testResources (default-testResources) # mule-netbeans-plugin ---
Using 'UTF-8' encoding to copy filtered resources.
Copying 12 resources
--- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) # mule-netbeans-plugin ---
Compiling 2 source files to D:\mule-netbeans-master\mule-netbeans-plugin\target\test-classes
--- maven-surefire-plugin:2.15:test (default-test) # mule-netbeans-plugin ---
Tests are skipped.
--- maven-jar-plugin:2.4:jar (default-jar) # mule-netbeans-plugin ---
Adding existing MANIFEST to archive. Found under: D:\mule-netbeans-master\mule-netbeans-plugin\target\classes\META-INF\MANIFEST.MF
Building jar: D:\mule-netbeans-master\mule-netbeans-plugin\target\mule-netbeans-plugin-0.8-SNAPSHOT.jar
--- nbm-maven-plugin:4.0.1:branding (default-branding) # mule-netbeans-plugin ---
No branding to process.
--- nbm-maven-plugin:4.0.1:nbm (default-nbm) # mule-netbeans-plugin ---
Copying module JAR to D:\mule-netbeans-master\mule-netbeans-plugin\target\nbm\netbeans\mule\modules with manifest updates
Generating Auto Update information for org.mule.tooling.netbeans
No updater.jar specified, cannot validate Info.xml against DTD
Building jar: D:\mule-netbeans-master\mule-netbeans-plugin\target\nbm\mule-netbeans-plugin-0.8-SNAPSHOT.nbm
--- maven-install-plugin:2.5:install (default-install) # mule-netbeans-plugin ---
Installing D:\mule-netbeans-master\mule-netbeans-plugin\target\mule-netbeans-plugin-0.8-SNAPSHOT.jar to C:\Users\harpreetsi\.m2\repository\org\mule\tooling\netbeans\mule-netbeans-plugin\0.8-SNAPSHOT\mule-netbeans-plugin-0.8-SNAPSHOT.jar
Installing D:\mule-netbeans-master\mule-netbeans-plugin\pom.xml to C:\Users\harpreetsi\.m2\repository\org\mule\tooling\netbeans\mule-netbeans-plugin\0.8-SNAPSHOT\mule-netbeans-plugin-0.8-SNAPSHOT.pom
Installing D:\mule-netbeans-master\mule-netbeans-plugin\target\mule-netbeans-plugin-0.8-SNAPSHOT.nbm to C:\Users\harpreetsi\.m2\repository\org\mule\tooling\netbeans\mule-netbeans-plugin\0.8-SNAPSHOT\mule-netbeans-plugin-0.8-SNAPSHOT.nbm
------------------------------------------------------------------------
Building Mule Tools for NetBeans 1.1
------------------------------------------------------------------------
--- maven-clean-plugin:2.4.1:clean (default-clean) # mule-netbeans ---
--- maven-install-plugin:2.3.1:install (default-install) # mule-netbeans ---
Installing D:\mule-netbeans-master\pom.xml to C:\Users\harpreetsi\.m2\repository\org\mule\tooling\netbeans\mule-netbeans\1.1\mule-netbeans-1.1.pom
------------------------------------------------------------------------
Reactor Summary:
Mule Netbeans XML ................................. SUCCESS [5.716s]
Mule Support Plugin ............................... SUCCESS [23.561s]
Mule Tools for NetBeans ........................... SUCCESS [0.069s]
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 33.336s
Finished at: Thu May 04 09:30:43 IST 2017
Final Memory: 30M/394M
------------------------------------------------------------------------
You need to set JAVA_HOME to your jdk7 home directory, for example on Microsoft Windows:
"C:\Program Files\Java\jdk1.7.0_40"
or on OS X:
/Library/Java/JavaVirtualMachines/jdk1.7.0_40.jdk/Contents/Home
We have the following config in our POM file:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
<executions>
<execution>
<id>surefire-it</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
<skip>false</skip>
</configuration>
</execution>
</executions>
</plugin>
This ensures that the tests are not executed during test phase. Tests are executed only during integration-test phase.
However, when we prepare for release (release:prepare), maven executes the tests during test phase. This causes our build to fail because our tests can be run only during Integration test phase (we use tomcat-maven plugin to deploy the packaged war before the tests can be executed).
I know that we can skip the tests by passing the parameter (-DskipTests etc.). We do not want to skip any tests, we just want release:prepare to execute just like any other maven goal.
Any suggestion/help is highly appreciated.
Try with the more general approach to disable the maven-surefire-plugin completely during test phase.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<executions>
<execution>
<id>default-test</id>
<!-- Disable the default-test by putting it in phase none -->
<phase>none</phase>
</execution>
<execution>
<!-- Enable the test during integration-test phase -->
<id>surefire-it</id>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
Edit
This is the output from my dry run of mvn release:prepare with the above configured surefire plugin:
C:\Users\maba\Development\svn\local\stackoverflow\Q12840869>mvn release:prepare -DdryRun
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Q12840869-1.0-SNAPSHOT 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-release-plugin:2.0:prepare (default-cli) # Q12840869 ---
[INFO] Resuming release from phase 'scm-check-modifications'
[INFO] Verifying that there are no local modifications...
[INFO] Executing: cmd.exe /X /C "svn --non-interactive status"
[INFO] Working directory: C:\Users\maba\Development\svn\local\stackoverflow\Q12840869
[INFO] Checking dependencies and plugins for snapshots ...
What is the release version for "Q12840869-1.0-SNAPSHOT"? (com.stackoverflow:Q12840869) 1.0: :
What is SCM release tag or label for "Q12840869-1.0-SNAPSHOT"? (com.stackoverflow:Q12840869) Q12840869-1.0: :
What is the new development version for "Q12840869-1.0-SNAPSHOT"? (com.stackoverflow:Q12840869) 1.1-SNAPSHOT: :
[INFO] Transforming 'Q12840869-1.0-SNAPSHOT'...
[INFO] Not generating release POMs
[INFO] Executing preparation goals - since this is simulation mode it is running against the original project, not the rewritten ones
[INFO] Executing goals 'clean verify'...
[WARNING] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.
[INFO] [INFO] Scanning for projects...
[INFO] [INFO]
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Building Q12840869-1.0-SNAPSHOT 1.0-SNAPSHOT
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO]
[INFO] [INFO] --- maven-clean-plugin:2.4.1:clean (default-clean) # Q12840869 ---
[INFO] [INFO] Deleting C:\Users\maba\Development\svn\local\stackoverflow\Q12840869\target
[INFO] [INFO]
[INFO] [INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) # Q12840869 ---
[INFO] [INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] [INFO] Copying 0 resource
[INFO] [INFO]
[INFO] [INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # Q12840869 ---
[INFO] [INFO] Compiling 1 source file to C:\Users\maba\Development\svn\local\stackoverflow\Q12840869\target\classes
[INFO] [INFO]
[INFO] [INFO] --- maven-resources-plugin:2.4.3:testResources (default-testResources) # Q12840869 ---
[INFO] [INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] [INFO] skip non existing resourceDirectory C:\Users\maba\Development\svn\local\stackoverflow\Q12840869\src\test\resources
[INFO] [INFO]
[INFO] [INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # Q12840869 ---
[INFO] [INFO] Compiling 1 source file to C:\Users\maba\Development\svn\local\stackoverflow\Q12840869\target\test-classes
[INFO] [INFO]
[INFO] [INFO] --- maven-jar-plugin:2.3.1:jar (default-jar) # Q12840869 ---
[INFO] [INFO] Building jar: C:\Users\maba\Development\svn\local\stackoverflow\Q12840869\target\Q12840869-1.0-SNAPSHOT.jar
[INFO] [INFO]
[INFO] [INFO] --- maven-surefire-plugin:2.7.2:test (surefire-it) # Q12840869 ---
[INFO] [INFO] Surefire report directory: C:\Users\maba\Development\svn\local\stackoverflow\Q12840869\target\surefire
-reports
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.stackoverflow.MainTest
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.041 sec
[INFO]
[INFO] Results :
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD SUCCESS
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 5.102s
[INFO] [INFO] Finished at: Thu Oct 11 17:10:29 CEST 2012
[INFO] [INFO] Final Memory: 13M/147M
[INFO] [INFO] ------------------------------------------------------------------------
Add your integration tests in a separate profile which isn't active by default. Add a triggerring rule or something. Then invoke the builds with the integration tests on a need by need basis. For example, on your CI (Jenkins/Hudson, TeamCity, Bamboo, etc) triggered the profile.
The problem you are currently facing is that you haven't made a separation between the two types of tests and when they should run. You have simply defined the phases you would like them to execute in. This isn't sufficient knowledge of the execution context for Maven to figure out what you would like to do and it invokes them during the release as well.
I would try an alternate approach, and try to configure the release plugin to always use -DskipTests as an argument so you don't need to specify it each time:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin<artifactId>
<configuration>
<arguments>-DskipTests</arguments>
</configuration>
</plugin>
In theory this should append -DskipTests to the arguments that the prepare and release goals pass to the sub-executions of Maven that they execute.
Use the maven-failsafe-plugin for the integration tests, and keep maven-surefire-plugin for the unit tests.
This will guarantee that the unit tests are completely segregated from the integration tests (and can therefore be turned off separately), and the integration tests are run during the "integration-test and verify phases of the build lifecycle".
I'm trying to configure my WAR project build to fail if the line or branch coverage is below given thresholds. I've been using the configuration provided on page 455 of the excellent book Java Power Tools, but with no success. Here's the relevant snippet of my project's Maven 2 POM:
<build>
...
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<check>
<!-- Per-class thresholds -->
<lineRate>80</lineRate>
<branchRate>80</branchRate>
<!-- Project-wide thresholds -->
<totalLineRate>90</totalLineRate>
<totalBranchRate>90</totalBranchRate>
</check>
<executions>
<execution>
<goals>
<goal>clean</goal>
<goal>check</goal>
</goals>
</execution>
<execution>
<id>coverage-tests</id>
<!-- The "verify" phase occurs just before "install" -->
<phase>verify</phase>
<goals>
<goal>clean</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
<instrumentation>
<excludes>
<exclude>au/**/*Constants.*</exclude>
</excludes>
<ignores>
<ignore>au/**/*Constants.*</ignore>
</ignores>
</instrumentation>
</configuration>
</plugin>
...
</plugins>
...
</build>
As I say, the coverage report works fine, the problem is that the "install" goal isn't failing as it should if the line or branch coverage is below my specified thresholds. Does anyone have this working, and if so, what does your POM look like and which version of Cobertura and Maven are you using? I'm using Maven 2.0.9 and Cobertura 2.2.
I've tried Googling and reading the Cobertura docs, but no luck (the latter are sparse to say the least).
To my knowledge, if the <haltOnFailure> element is set to true and any of the specified checks fails, then Cobertura will cause the build to fail which is what you're asking for. But actually, this element defaults to true if you do not specify it so you don't have to add it to your configuration checks. Failing the build below any coverage threshold is (or at least should be) the default behavior.
EDIT: I did some further testing and haltOnFailure seems to be working as expected on my environment (Maven 2.2.1. and versions 2.3, 2.2, 2.1 of the plugin i.e. versions 1.9.2, 1.9, 1.8 of cobertura on Linux). I'm updating this answer with the result below.
Actually, I've added an <execution> element to my pom. I may be misinterpreting the part of cobertura:check's documentation that says it "Binds by default to the lifecycle phase: verify" but, without the <execution> element, cobertura:check wasn't triggered during the verify phase of my build. Below the setup I've use for the cobertura-maven-plugin:
<project>
...
<build>
...
<plugins>
...
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.3</version>
<configuration>
<check>
<!--<haltOnFailure>true</haltOnFailure>--><!-- optional -->
<!-- Per-class thresholds -->
<lineRate>80</lineRate>
<branchRate>80</branchRate>
<!-- Project-wide thresholds -->
<totalLineRate>90</totalLineRate>
<totalBranchRate>90</totalBranchRate>
</check>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<!--<goal>clean</goal>--><!-- works if uncommented -->
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I get the following result when running mvn clean install on a freshly generated maven project (with mvn archetype:create) patched with the plugin configuration mentioned above:
$ mvn archetype:create -DgroupId=com.mycompany.samples -DartifactId=cobertura-haltonfailure-testcase
...
$ mvn clean install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building cobertura-haltonfailure-testcase
[INFO] task-segment: [clean, install]
[INFO] ------------------------------------------------------------------------
[INFO] [clean:clean {execution: default-clean}]
[INFO] Deleting directory /home/pascal/Projects/cobertura-haltonfailure-testcase/target
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/pascal/Projects/cobertura-haltonfailure-testcase/src/main/resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Compiling 1 source file to /home/pascal/Projects/cobertura-haltonfailure-testcase/target/classes
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/pascal/Projects/cobertura-haltonfailure-testcase/src/test/resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Compiling 1 source file to /home/pascal/Projects/cobertura-haltonfailure-testcase/target/test-classes
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: /home/pascal/Projects/cobertura-haltonfailure-testcase/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.mycompany.samples.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.09 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] [jar:jar {execution: default-jar}]
[INFO] Building jar: /home/pascal/Projects/cobertura-haltonfailure-testcase/target/cobertura-haltonfailure-testcase-1.0-SNAPSHOT.jar
[INFO] Preparing cobertura:check
[WARNING] Removing: check from forked lifecycle, to prevent recursive invocation.
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/pascal/Projects/cobertura-haltonfailure-testcase/src/main/resources
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [cobertura:instrument {execution: default}]
[INFO] Cobertura 1.9.2 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Instrumenting 1 file to /home/pascal/Projects/cobertura-haltonfailure-testcase/target/generated-classes/cobertura
Cobertura: Saved information on 1 classes.
Instrument time: 337ms
[INFO] Instrumentation was successful.
[INFO] [resources:testResources {execution: default-testResources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/pascal/Projects/cobertura-haltonfailure-testcase/src/test/resources
[INFO] [compiler:testCompile {execution: default-testCompile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [surefire:test {execution: default-test}]
[INFO] Surefire report directory: /home/pascal/Projects/cobertura-haltonfailure-testcase/target/surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.mycompany.samples.AppTest
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.098 sec
Results :
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO] [cobertura:check {execution: default}]
[INFO] Cobertura 1.9.2 - GNU GPL License (NO WARRANTY) - See COPYRIGHT file
Cobertura: Loaded information on 1 classes.
[ERROR] com.mycompany.samples.App failed check. Line coverage rate of 0.0% is below 80.0%
Project failed check. Total line coverage rate of 0.0% is below 90.0%
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Coverage check failed. See messages above.
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 18 seconds
[INFO] Finished at: Sat Oct 24 21:00:39 CEST 2009
[INFO] Final Memory: 17M/70M
[INFO] ------------------------------------------------------------------------
$
I didn't test with maven 2.0.9, but on my machine, haltOnFailure generates a BUILD ERROR and halt the build. I don't see any differences with your plugin configuration, I can't reproduce the behavior you describe.
Add the following to the <check/> configuration.
<haltOnFailure>true</haltOnFailure>
mvn clean install -Dcobertura.skip=true