I have a springboot project. I am trying to get emma coverage report for the project.
Method 1:
I executed mvn emma:emma command on it. Coverage.em file has been generated. I dont know what to do with it
Method 2:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.7</version>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
<version>1.0-alpha-3</version>
<inherited>true</inherited>
</plugin>
</plugins>
</reporting>
I have added the above piece of code to pom.xml and ran mvn site command.
site folder had been created with some contents in it. I tried to open up index.html, i could see the list of things like project summary, dependencies etc. I clicked on Project Reports and then Emma Coverage Report. Then it showed up page can't be displayed. It is trying to access the path C:\Full Stack Development\ProjectManagement\target\site\emma\index.html . The folder emma is empty.
Screenshot of page displayed
Method 3:
I have added the following plugin using build tag. Same happened as in method 2.
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>emma-maven-plugin</artifactId>
<version>1.0-alpha-3</version>
<inherited>true</inherited>
<executions>
<execution>
<phase>process-classes</phase>
<goals>
<goal>instrument</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Related
I have two project, which run on two different platform Android and Ios. which i am controlling by different suite runner file . when i am trying to run same via Maven , whichever plugin mention last , only that profile run , how can i make working of all.
<plugins>
<!-- build standalone exe jar -->
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<skip>false</skip>
<mainClass>platform.atcios.SuiteRunner</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>
<configuration>
<skip>false</skip>
<mainClass>platform.atc.SuiteRunner</mainClass>
</configuration>
</plugin>
</plugins>
</build>
in this , if atc is mention in last , when run for ios , atcios giving build fail error and viceversa.
how to make both work
You need to define different <executions> inside the same <plugin> tag.
Each <execution> may have its own <configuration>.
Trying to integrate Clover maven plugin to get the code coverage of my project.
After I build my project with mvn clean install, target folder looks like below
But I am looking for code coverage with HTML reports (Which will give us the code coverage with package wise, class wise views)
Will the line <generateHtml>true</generateHtml> does it ?, if yes, something wrong in my configuration.
How can I get HTML reports out of Clover maven plugin?
Below is the pom.xml code
<build>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
<configuration>
<!-- <targetPercentage>80%</targetPercentage> -->
<generateHtml>true</generateHtml>
<generatePdf>true</generatePdf>
<generateXml>true</generateXml>
</configuration>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>instrument</goal>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>com.atlassian.maven.plugins</groupId>
<artifactId>maven-clover2-plugin</artifactId>
<configuration>
<generateHtml>true</generateHtml>
<generatePdf>true</generatePdf>
<generateXml>true</generateXml>
</configuration>
</plugin>
</plugins>
</reporting>
Please use mvn clean install clover2:clover command ad see if you get the html report generated in target/site/clover/index.html file.
The clover2:clover goal should instrument your test classes, execute the test cases and record the code coverage information.
In Maven, is there a way to get a list of the active profiles, say, as a property or as a text file?
More specifically, when I run:
mvn resources:resources -P MyProfile
I want to get the string MyProfile somewhere I can read it into my Java program.
Maven 3.2.1
Thanks
Edit
I attempted to configure the Maven Help plugin to run the active-profiles goal whenever the goal resources:resources is run by configuring an execution to participate in the process-resources phase as shown below. That did not work either ...:
<packaging>jar</packaging>
<build>
<plugins>
<!-- ... -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>2.2</version>
<configuration>
<output>${basedir}/target/active-profiles.txt</output>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>active-profiles</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
You could try this maven plugin. The configuration below will create a text file that will contain the profiles that were active during the build.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>2.2</version>
<configuration>
<output>${basedir}/target/active-profiles.txt</output>
</configuration>
</plugin>
I'm using maven-surefire-report-plugin in order to generate the unit tests report.
This is working fine however the report contains links to images which are not presented.
How can I make maven copy the icons required for the report?
Should I use skin? I tried it without success.
Here is the maven-surefire-report-plugin definition:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.16</version>
<configuration>
<showSuccess>true</showSuccess>
</configuration>
</plugin>
</plugins>
</reporting>
I tried to add skin plugin but it didn't affect the report:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.maven.skins</groupId>
<artifactId>maven-application-skin</artifactId>
<version>1.0</version>
</dependency>
</dependencies>
</plugin>
What is missing to present the report with the images?
The question is probably too old, but I had the same problem and I found this answer.
The command mvn site -DgenerateReports=false generates only css and images for surefire-report.html and works fine.
You must genereate the site using the Site Plugin:
mvn site
If you have already generated the reports, then you can speed this up by skipping this:
mvn site -DgenerateReports=false
mvn site -DgenerateReports=false
I did it like this, but it's a hack:
<build>
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven-surefire.version}</version>
<configuration>
<testSourceDirectory>src/test/java</testSourceDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>${maven-surefire.version}</version>
<configuration>
<linkXRef>false</linkXRef>
<showSuccess>true</showSuccess>
</configuration>
<executions>
<execution>
<id>generate-test-report</id>
<phase>test</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>${project.basedir}/src/test/resources/css</directory>
<targetPath>${project.build.directory}/site/css</targetPath>
<includes>
<include>*.css</include>
</includes>
</resource>
</resources>
</build>
I have the following jasmine tests configuration in my project pom.xml:
<pluginManagement>
<plugins>
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
<version>1.1.0</version>
<executions>
<execution>
<goals>
<goal>test</goal>
<goal>jasmine</goal>
</goals>
</execution>
</executions>
<configuration>
<jsSrcDir>${basedir}/src/main/js</jsSrcDir>
<sourceIncludes>
<include>myCode.js</include>
</sourceIncludes>
<jsTestSrcDir>${basedir}src/test/js/specs</jsTestSrcDir>
<specIncludes>
<include>mySpec.js</include>
</specIncludes>
</configuration>
</plugin>
...
with this configuraton I can run jsamine:test and the test wil run.
I want to run the tests as part of the goal test, but Maven won't run them.
I even tried removing the line <goal>jasmine</goal> but Maven still won't run the jasmine tests.
What am I doing wrong?
You must also add the execution of the plugin like this into you project:
<project>
<build>
<plugins>
<plugin>
<groupId>com.github.searls</groupId>
<artifactId>jasmine-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
cause the one you've defined in pluginManagement does not really execute the plugin.