my projects pom.xml has a red X over it and when I go into the "Problems" tab, Eclipse is showing an Error message.
Problems tab gives the following message:
Plugin execution not covered by lifecycle configuration: com.lazerycode.selenium:driver-binary-downloader-maven-plugin:1.0.18:selenium (execution: default, phase: test-compile)
How to remove this red X over pom.xml?
Java version is 1.8
Screenshot of the error message
<profiles>
<profile>
<id>selenium-tests</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>com.lazerycode.selenium</groupId>
<artifactId>driver-binary-downloader-maven-plugin</artifactId>
<version>${driver-binary-downloader-maven-plugin.version}</version>
<configuration>
<rootStandaloneServerDirectory>${project.basedir}/ServerExes/selenium_standalone_binaries</rootStandaloneServerDirectory>
<downloadedZipFileDirectory>${project.basedir}/ServerExes/selenium_standalone_zips</downloadedZipFileDirectory>
<customRepositoryMap>${project.basedir}/TestData/RepositoryMap.xml</customRepositoryMap>
<overwriteFilesThatExist>${overwrite.binaries}</overwriteFilesThatExist>
<onlyGetDriversForHostOperatingSystem>true</onlyGetDriversForHostOperatingSystem>
<fileDownloadRetryAttempts>${retry.attempts}</fileDownloadRetryAttempts>
<fileDownloadReadTimeout>${read.timeout}</fileDownloadReadTimeout>
<operatingSystems>
<windows>true</windows>
<linux>true</linux>
<mac>true</mac>
</operatingSystems>
</configuration>
<executions>
<execution>
<goals>
<goal>selenium</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${surefire-plugin.version}</version>
<configuration>
<suiteXmlFiles>
<!-- TestNG suite XML files -->
<!-- <file>testNg_UI_Verification.xml</file> -->
<!-- <file></file> -->
<file>${testNGFileName}</file>
</suiteXmlFiles>
<properties>
<property>
<name>suitethreadpoolsize</name>
<value>2</value>
</property>
</properties>
<systemPropertyVariables>
<proxyEnabled>${proxyEnabled}</proxyEnabled>
<proxyHost>${proxyHost}</proxyHost>
<proxyPort>${proxyPort}</proxyPort>
<phantomjs.binary.path>${phantomjs.binary.path}</phantomjs.binary.path>
<webdriver.chrome.driver>${webdriver.chrome.driver}</webdriver.chrome.driver>
<webdriver.ie.driver>${webdriver.ie.driver}</webdriver.ie.driver>
<webdriver.opera.driver>${webdriver.opera.driver}</webdriver.opera.driver>
<webdriver.gecko.driver>${webdriver.gecko.driver}</webdriver.gecko.driver>
<webdriver.edge.driver>${webdriver.edge.driver}</webdriver.edge.driver>
</systemPropertyVariables>
<additionalClasspathElements>
<additionalClasspathElement>${project.basedir}/db_queries/ojdbc14.jar</additionalClasspathElement>
</additionalClasspathElements>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
If despite the error you can execute the project then you can use "Mark goal selenium as ignored in eclipse preferences".
Related
I've got a big issue with the integration of JaCoCo maven plugin for the code covering of SonarQube 6.0.
I've got a multi-module Maven project lets say :
master
|--core
|--web
|--process
in the master pom.xml, I've setted a reporting profile like that :
<profile>
<id>reporting</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<executions>
<execution>
<id>pre-unit-test</id>
<!--<phase>test</phase> -->
<goals>
<goal>prepare-agent</goal>
</goals>
<configuration>
<!-- Sets the path to the file to write the execution data to. -->
<destFile>${sonar.jacoco.reportPath}</destFile>
<!-- Connection with SureFire plugin -->
<propertyName>sonarUnitTestArgLine</propertyName>
</configuration>
</execution>
<execution>
<id>post-unit-test</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
<configuration>
<!-- Sets the path to where the execution data is located. -->
<dataFile>${sonar.jacoco.reportPath}</dataFile>
<!-- Sets the output directory for the code coverage report. -->
<outputDirectory>${jacoco.ut.outputdir}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>once</forkMode>
<argLine>${sonarUnitTestArgLine} -XX:MaxPermSize=512M -Xms512m -Xmx512m</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
in the childs, I overload the configuration by adding some exclusions :
<!-- First attempt -->
<properties>
<sonar.jacoco.excludes>**/model/**/*</sonar.jacoco.excludes>
</properties>
<!-- Second attempt -->
<properties>
<sonar.coverage.exclusions>**/model/**/*</sonar.coverage.exclusions>
</properties>
<!-- Third attempt -->
<profiles>
<profile>
<id>reporting</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<excludes>
<!-- Exclude model classes (POJO's) -->
<exclude>**/model/**/*.class</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
the idea here is to remove the Pojo of the code coverage ( we also do it for other types of Class ...)
When I run the mvn command line :
mvn clean generate-sources install verify -P reporting -fn
All my reports are well generated but in Sonar, the exculsions aren't been taking into account ...
Please can you help me fixing this issue ?
After a lot of reasearch, I've found the solution for this problem, I post the answers to help poeple ho'll have the same issue :
In the master-module
<properties>
<sonar.coverage.exclusions>
**/patternA/**/*,
**/patternB/**/*
</sonar.coverage.exclusions>
</properties>
In the sub-modules
<profiles>
<profile>
<id>report</id>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<excludes>
<!-- Exclude model classes (POJO's) -->
<exclude>**/patternA/**/*.class</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
in the master pom
I tried adding just the below details in properties section and it worked for me.
<sonar.coverage.exclusions>
**/patternA/*.java,
**/patternB/*.java
</sonar.coverage.exclusions>
This is the profile part of pom.xml
<profiles>
<profile>
<!-- The default profile skips all tests, though you can tune it
to run just unit tests based on a custom pattern -->
<!-- Seperate profiles are provided for running all tests, including
Arquillian tests that execute in the specified container -->
<id>default</id>
<activation>
<activeByDefault>true</activeByDefault>
<property>
<name>!default</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>${skipTests}</skip>
<environment>${sv.environment}</environment>
<config-file>${test.config.file}</config-file>
<excludes>
<exclude>**/*ArqTest.java</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<!-- An optional Arquillian testing profile that executes tests
in a remote JBoss EAP instance -->
<!-- Run with: mvn clean test -Parq-jbossas-remote -->
<id>arq-jbossas-remote</id>
<build>
<plugins>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>false</skip>
<skipTests>false</skipTests>
<environment>${sv.environment}</environment>
<config-file>${test.config.file}</config-file>
<includes>
<include>**/*ArqTest.java</include>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-maven-plugin</artifactId>
<version>${version.shrinkwrap.resolver}</version>
<executions>
<execution>
<goals>
<goal>propagate-execution-context</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-remote</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</profile>
</profiles>
Basically, if I run maven with:
mvn clean test -Parq-jbossas-remote
*ArqTest classes are ignored because of the part that is included in the default profile:
<excludes>
<exclude>**/*ArqTest.java</exclude>
</excludes>
How can I make ignore the default profile at all if another one is specified ?
Below is my maste pom file profile for my product unit tests. we have junit plug-in tests.
These pom file configurations not giving me the jacoco code coverage file(.exec) in any location.
please help me if any wrong some where. Thank you
<profile>
<id>unit-tests</id>
<modules>
<module>../../../test/com.xxxx.tools.comms.test.utilities</module>
<!-- product related unit tests
<module>../../../test/com.xxxx.comms.product.test</module>
<module>../../../test/com.xxxx.comms.product.mas.test</module>-->
<module>../../../test/com.xxxx.comms.product.iv.test</module>
</modules>
<properties>
<!-- Properties to enable jacoco code coverage analysis -->
<sonar.core.codeCoveragePlugin>jacoco</sonar.core.codeCoveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.2.201409121644</version>
<configuration>
<!-- Where to put jacoco coverage report -->
<destFile>C:/Userdata/product/GIT/Team/coverage/product1/jacoco/12.exec</destFile>
</configuration>
<executions>
<execution>
<id>jacoco-initialize</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-site</id>
<phase>package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<build>
<plugins>
<!-- Use of Tycho -->
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-maven-plugin</artifactId>
<version>${tycho-version}</version>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-surefire-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<includes>
<include>**/Tests*.java,**/*Tests.java,**/*TestCase.java,**/Test*.java,**/*Test.java</include>
</includes>
<argLine>${argLine}</argLine>
<useUIHarness>true</useUIHarness>
<!-- Kill test JVM if tests take more than 1 minute to finish -->
<forkedProcessTimeoutInSeconds>600</forkedProcessTimeoutInSeconds>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<!-- Configuration of target platforms -->
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>target-platform-configuration</artifactId>
<version>${tycho-version}</version>
<configuration>
<pomDependencies>consider</pomDependencies>
<resolver>p2</resolver>
<environments>
<environment>
<os>win32</os>
<ws>win32</ws>
<arch>x86</arch>
</environment>
</environments>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-packaging-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<!-- workaround for TYCHO-349 or TYCHO-313 -->
<strictVersions>false</strictVersions>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-compiler-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
I got the problem source.
The culprit is <argLine> parameter in tycho-surefire-plugin configuration.
If this param is present, jacoco file is not generated. I removed it and now .exec file is generated.
More info found at tycho-surefire argLine causes no jacaco.exec
I cannot run integration tests, but only unit tests.
Here is my Maven config (see code below). It uses two plugins. One of them is maven-failsafe-plugin and the second one is maven-surefire-plugin.
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<skipTests>false</skipTests>
<skipITs>${skipTests}</skipITs>
<skipUTs>${skipTests}</skipUTs>
</properties>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8.7</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<skipTests>${skipUTs}</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.16</version>
<configuration>
<skipTests>${skipTests}</skipTests>
<skipITs>${skipITs}</skipITs>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
I try to run unit tests using this commend
mvn clean test
And there is the command to start integration tests separately
mvn clean failsafe:integration-test verify
Result of invocation of the last command is
[INFO] --- maven-failsafe-plugin:2.16:integration-test (default-cli) # integration-test-demo ---
[INFO] No tests to run.
I use profiles for these:
Properties
<properties>
<!-- Only unit tests are run by default. -->
<skip.integration.tests>true</skip.integration.tests>
<skip.unit.tests>false</skip.unit.tests>
</properties>
Profiles
<profiles>
<profile>
<id>all-tests</id>
<properties>
<build.profile.id>all-tests</build.profile.id>
<!-- All tests are run. -->
<skip.integration.tests>false</skip.integration.tests>
<skip.unit.tests>false</skip.unit.tests>
</properties>
</profile>
<profile>
<id>dev</id>
</profile>
<profile>
<id>integration-tests</id>
<properties>
<!-- Used to locate the profile specific configuration file. -->
<build.profile.id>integration-test</build.profile.id>
<!-- Only integration tests are run. -->
<skip.integration.tests>false</skip.integration.tests>
<skip.unit.tests>true</skip.unit.tests>
</properties>
</profile>
</profiles>
maven-surefire-plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<configuration>
<!-- Skips unit tests if the value of skip.unit.tests property is true -->
<skipTests>${skip.unit.tests}</skipTests>
<!-- Excludes integration tests when unit tests are run. -->
<excludes>
<exclude>**/*IntegrationTest.java</exclude>
</excludes>
</configuration>
</plugin>
maven-failsafe-plugin
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.15</version>
<executions>
<!-- Ensures that both integration-test and verify goals of the Failsafe Maven plugin are executed. -->
<execution>
<id>integration-tests</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
<configuration>
<!-- Skips integration tests if the value of skip.integration.tests property is true -->
<skipTests>${skip.integration.tests}</skipTests>
<includes>
<include>**/*IntegrationTest.java</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
The Integration Tests end in ...IntegrationTest.java, and I run the profile that I required (all-tests, integration-tests). The unit tests are run by default.
I am pretty sure that I copied this from somewhere, but now I can not remember the link. Sorry.
Is there way to skip generate-sources in Maven?
Doing it via command line options
I've scenario where I generate CXF classes when ever I there is change in WSDL or WADL. Hence I generate it explicitly whenever I need. Hence I created a separate profile a new profile cxf-gen along with my usual dev, uat, syst. which has plugins to generate the classes. In short whenever I need to regenerate the classes I switch to the profile and run generate-sources. Here is sample profile I use.
<profiles>
<profile>
<id>dev</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<envName>dev</envName>
</properties>
</profile>
<profile>
<id>uat</id>
<properties>
<envName>uat</envName>
</properties>
</profile>
<profile>
<id>jaxB-gen</id>
<properties>
<envName>dev</envName>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>jaxb2-maven-plugin</artifactId>
<version>1.5</version>
<configuration>
<!-- CONFIGS ->
</configuration>
<executions>
<execution>
<id>xjc</id>
<goals>
<goal>xjc</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>code-gen</id>
<properties>
<envName>dev</envName>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-codegen-plugin</artifactId>
<version>${cxf.version}</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<!-- CONFIGS ->
</configuration>
<goals>
<goal>wsdl2java</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- wadl2java Required only when JAXRS classes are to be generated -->
<plugin>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-wadl2java-plugin</artifactId>
<version>2.7.6</version>
<executions>
<execution>
<id>generate-sources</id>
<phase>generate-sources</phase>
<configuration>
<!-- CONFIGS ->
</configuration>
<goals>
<goal>wadl2java</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.googlecode.jsonschema2pojo</groupId>
<artifactId>jsonschema2pojo-maven-plugin</artifactId>
<version>0.3.7</version>
<configuration>
<!-- CONFIGS ->
</configuration>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
This command line option should work if you are using maven-source-plugin (works with Maven 3.6.0):
-Dmaven.source.skip=true
This is an old question and although some answers would somehow work none of them are ideal.
This answer does not break clean builds: calling "mvn <goal>" still produces the expected and backward-compatible result, which is good for continuous integration. Also this answer does not rely on committing generated code to version control, which is a bad idea as it might become out of sync with the source.
I am assuming the generate-sources phase is bound to a plugin goal.
The answer is to create a profile called "clean-build" which is active by default and contains your plugin binding. When a developer trusts they can safely skip generate-sources they may run the following.
mvn -P !clean-build <goal>
Or if the exclamation mark needs to be escaped.
mvn -P \!clean-build <goal>
Here is what the pom.xml might look like.
<profiles>
<profile>
<id>clean-build</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
...
<executions>
<execution>
...
<phase>generate-sources</phase>
...
</execution>
</executions>
...
</plugin>
</plugins>
</build>
</profile>
</profiles>
This answer requires Maven 2.0.10+.