I am using FindBugs with maven, using the following configuration:
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.3</version>
<configuration>
<xmlOutput>true</xmlOutput>
<xmlOutputDirectory>target/site</xmlOutputDirectory>
<plugins>
<plugin>
<groupId>com.mebigfatguy.fb-contrib</groupId>
<artifactId>fb-contrib</artifactId>
<version>6.2.0</version>
</plugin>
</plugins>
</configuration>
</plugin>
</plugins>
</reporting>
I run:
mvn clean
mvn package
mvn site
mvn findbugs:gui
And I get all errors listed in GUI, but I realized that all bugs detected by fb-contrib plugin are shown under Experimental\Testing prototype and incomplete bug pattern\Unknown bug pattern and FindBugs doesn't show any info about bug pattern.
Is this correct? Is it possible to get bug pattern info as with the FindBugs pattern bugs?
Thanks in advance.
findbugs-maven-plugin doesn't supply the configured plugins, when it launches the FindBugs GUI (Issue #37). I've submitted a pull request fixing this, you could grab my fork and build the plugin.
Alternatively, if your plugins don't change often, you could add them manually in the GUI: open the menu Edit -> Preferences, switch to the Plugins tab, install the plugin jar from the local Maven repository. At least on Windows the plugin configuration persists between GUI launches via the registry.
Related
I'm trying to get Findbugs working with an existing/mature Maven project.
I added the following to the <plugins> tag in my pom.xml:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.5</version>
<configuration>
<effort>Max</effort>
<threshold>Low</threshold>
<xmlOutput>true</xmlOutput>
</configuration>
</plugin>
I then see that the Findbugs plugin runs when you run mvn site. Since the build invocation for my project is aleady:
mvn clean jacoco:prepare-agent test site jxr:jxr -Dkey1=123 -Dkey2=456 -Denvironment=DEV
...I just run it like I normally do. The build succeeds and I go to my normal site summary in my browser:
No where from here can I find any "Findbugs" reports or anything that mentions Findbugs at all. When I do a grep for Findbugs (grep -rl "findbugs" .) I do see that many of my ./target/surefire-reports/TEST-*.xml files have the term "findbugs" mentioned in them.
Worth mentioning that I do not see a target/site/findbugs.html file after the successful build...
Any ideas as to where I can find HTML Findbugs output under my Site summary (or anywhere else)? Looking for a nice HTML report showing which (if any) Findbugs checks failed.
You should add the FindBugs plugin in the <plugins> section of the <reporting> section of your pom.xml:
<project>
...
<reporting>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>3.0.5</version>
</plugin>
</plugins>
</reporting>
...
</project>
The question just states <plugins>, not sure if that could be the issue.
I am using Maven, Maven checkstyle plugin, Jenkins and Jenkins checkstyle plugin.
I have 7 projects total. 1 parent and 6 child projects.
I have the following 3 scenarios :
Checkstyle report for all project.n parent pom i declared checkstyle plugin in tag:
I run mvn clean site command
It working both ways in eclipse with maven. and in Jenkins also.
Giving checkstyle reports for all 7 projects.
Checkstyle report for all project except 2 project.
I deleted part in parent pom and i added
I added in remaining 4 projects, i declared checkstyle plugin in tag.
It working in eclipse but not working in Jenkins.
Please give solution
My code:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
<configuration>
<configLocation>../parent-project/checkstyle.xml</configLocation>
</configuration>
</plugin>
</plugins>
3.
I deleted checkstyle plugin in parent
I added checkstyle plugin in 4 needed projects same above code.
In remaining 2 child projects I added like this.
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
I run 'mvn clean site'
It working in Maven as expected but not working in Jenkins.
What I mean by 'not working in Jenkins' is that I installed checkstyle plugin in Jenkins, In the Jenkins job i selected 'Publish Checkstyle analysis results' check box. In scenario-1 i am able to see the checkstyle link in the jenkins job page. And if i click on that all code violations reports are appearing. In other scenarios (2,3) the Checkstyle link also not appearing.
Just found the solution.
In the project configure menu, in the "Goals and options" field you need to add 'site' without the ' characters. In my "Goals and options" field I had: clean install. This did not run checkstyle. But then I changed it to: clean install site. And now checkstyle runs!
Hope this solves your problem.
Edit:
My pom.xml has been extended with the tag:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.10</version>
</plugin>
</plugins>
to run checkstyle. Try using only that for checkstyle and then run the project again.
The Xcode Maven Plugin from http://sap-production.github.io/xcode-maven-plugin/site is a nice maven plugin for people who like maven and wan't to avoid some pain with xcode dependencies, framework creation and such.
It creates and installs lib and headers in the repository.
The headers are bundled in a .tar file during the process.
For some reason, I need to edit the tar file and add a few files in it before installing.
But as I'm quite the noob regarding maven, I need some help !
How can I modify on a byproduct of Maven before it is installed ? I suppose I can write some script that add some files to the .taf, but how can I be sure it's executed prior the installation ?
#Redwarp - It's been a while since this question was asked, but I'll offer up an answer.
You can configure a Maven plug-in's goal to be executed during a particular phase in the Maven build lifecycle.
Pick a phase that's executed before the install phase. Package may be the best phase for you to edit your tar file and add your required files.
The following is just a generalized example (the focus should be on phase and goal):
<project>
...
<build>
<plugins>
<plugin>
<groupId>com.sap.prd.mobile.ios.mios</groupId>
<artifactId>xcode-maven-plugin</artifactId>
<version>1.12.0</version>
<extensions>true</extensions>
<executions>
<execution>
<id>do-something</id>
<phase>package</phase>
<configuration>
...
</configuration>
<goals>
<goal>plugin-goal</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
...
</project>
Find the plug-ins that suit your needs and bind their goals to the appropriate Maven lifecycle phases...which there's a good chance that you have already figured out by this point.
I am trying to add emma to project build. I went through the tutorials here -
Maven emma plugin
But i am not able to figure out how do I specify what kind of reports to generate - i mean txt or xml. How do I add this part to the maven build so that when the POM file builds it generates either txt or xml report in some specific directory.
The functionality has been included in the development version of the Sonatype Emma Plugin, emma-maven-plugin-1.3-SNAPSHOT, but it has not been released yet.
https://github.com/sonatype/emma-maven-plugin/pull/1
and
https://github.com/sonatype/emma-maven-plugin/pull/2
Note that this is not the same as the Codehaus Emma plugin that you referenced in your question, but the change should be minimal.
Once version 1.3 is released, you should be able to put the following in the reporting section of your pom.xml file to get the full range of output formats:
<reporting>
<plugins>
<plugin>
<groupId>org.sonatype.maven.plugin</groupId>
<artifactId>emma-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<formats>html,xml,txt</formats>
</configuration>
</plugin>
</plugins>
</reporting>
You can use the emma4it-maven-plugin for reporting. The 1.3 version has some issue.
But the 1.4-SNAPSHOT works fine.
Here is the git link for the same : https://github.com/billmag/emma4it-maven-plugin.git
Clone the repo and do a mvn clean install.
Also you can use 1.2 version in case you don't want to use a SNAPSHOT version.
The configuration in pom for reporting is as follows:
<reporting>
<plugins>
<plugin>
<groupId>org.sonatype.maven.plugin</groupId>
<artifactId>emma4it-maven-plugin</artifactId>
<version>1.4-SNAPSHOT</version>
<configuration>
<verbosity.level>verbose</verbosity.level>
<metadatas>coverage.em path</metadatas>
<instrumentations>coverage.ec path</instrumentations>
<reportDirectory>target/emma/</reportDirectory>
<baseDirectory>${project.basedir}/target</baseDirectory>
<formats>xml,html</formats>
</configuration>
</plugin>
</plugins>
</reporting>
Command to get the reports
mvn org.sonatype.maven.plugin:emma4it-maven-plugin:1.4-SNAPSHOT:report
I am new to maven. I have product structure as following
myWebProduct
pom.xml
coreModule
webModule
htmlTestModule
The maven release plugin is defined at the company level of pom.xml file which is parent of myWebProduct. It has set release plugin run default goals of deploy and default preparationGoals clean verify install.
I want to release product in myWebProduct level which works fine except I would like to skip release the htmlTestModule. Because deploy life cycle on htmlTestModule will cause deployment of war file to remote Tomcat servers and I don’t want this happening during release.
I tried to add following in pom.xml of the htmlTestModule.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.1</version>
<configuration>
<skip>true</skip>
<preparationGoals>clean validate</preparationGoals>
<goals>testCompile</goals>
</configuration>
</plugin>
But when running 'mvn release:perform' at myWebProduct. I have seen the deploy goal was still executed on htmlTestModule. Could anyone help with this?
And I also tried following on htmlTestModule:
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.5</version>
<executions>
<execution>
<id>donotRunMe</id>
<phase>none</phase>
</execution>
</executions>
</plugin>
Still, the deploy goal always executed in htmlTestModule.
Thanks
I think you're taking the wrong approach here. Let me explain.
The deploy phase of maven is not meant to mean deploy to a remote server or anything like this. This is meant to be deploy to a remote repository.
Hence I believe you shouldn't try to skip the deploy phase in your module, but un-tie the deployment to a remote Tomcat server from the deploy phase, by making it a specific goal for example.