I run FindBugs from Ant task. I have preferences file .fbprefs which I want FindBugs to use, so that the bug report produced by Ant matches the one produced by Eclipse.
Unfortunately the ant task is based on filter files, see http://findbugs.sourceforge.net/manual/filter.html
You should start using filter files not the Eclipse plugin configuration. Check this resource: http://docs.codehaus.org/display/SONAR/Project+settings#Projectsettings-Excluderesources
It should help you create a filter which corresponds to your Eclipse FindBugs plugin configuration.
Related
I'm generating several XML report files via ant task (checkstyle, findbugs, macker, jacoco, ncss, classycle, etc.).
I want the to reuse the generated files in jenkins sonar plugin. Is there any way to do so?
I'm planning in setting the properties in the project specific sonar-project.properties file. But I can't find any of these options at codehaus documentation site.
There's no point to reuse:
checkstyle or findbugs reports as SonarQube also executes those tools
ncss or classycle reports as it is SonarQube very job to compute those metrics
For JaCoCo, you can reuse reports if you don't want SonarQube to execute the unit tests again. See http://docs.codehaus.org/display/SONAR/Code+Coverage+by+Unit+Tests+for+Java+Project.
I'm trying to Gradle-ize our build by using Gradle to execute the Ant build. I'm using the java plugin so I can set source/target and I'm using ant.importBuild 'build.xml'. When I execute Gradle, I get the error above. I understand that both Ant and Gradle have these targets/tasks in common: clean, jar, javadoc, test. One option is to change the Ant target names in build.xml, but I'm hoping there's an easier way as I have a lot of projects and build files. I found this "wrapper" solution (http://issues.gradle.org/browse/GRADLE-771), but this did not work for me. How can I solve this?
Your options are:
Do not apply the plugin to the same project that imports the Ant build.
Rename the conflicting targets in the Ant build script.
You can rename all the ant targets:
ant.importBuild('build.xml') { String oldTargetName ->
return 'ant_' + oldTargetName
}
I am developing a java project using Eclipse as IDE and ant as the build tool. For logging I am making use of log4j library. I am able to get the log messages in a log file for my whole application using log4j configuration.
But when I build project using ANT, the ANT build messages are still posted to console.I want to make sure that when I build the project, the build messages that ANT generates, like build failure/success, should also be posted to that sames logger file using log4j.
Please help me in this if anyone has got an idea. Thanks
To pass the logging log4j, you can use this when you run Ant:
$ ant -listener org.apache.tools.ant.listener.Log4jListener
The configuration of log4j is then up to you. See the information on Listeners in the Ant manual.
Our Eclipse RCP project contains several plugins and has an existing Ant build using PDE build. I want to add Sonar to our build pipeline. I am aware that Sonar supports analyzing Ant builds in general with the Sonar Ant Task. I am looking for someone who has done this already for a multi-plugin Eclipse RCP application. The Sonar report should look like the report of a multi-module Maven project. Are there any templates/build scripts to copy from available?
Here at SonarSource, we are analysing our Sonar Eclipse Plugins using a combination of Ant and Maven. Maybe this can help you: here are the sources => https://github.com/SonarSource/sonar-eclipse
I have configured Log4j in my project and that is invoked by an Ant task.
I want the Ant logs as well as project logs to be written to single file along with timestamps.
Could you let me know how to take care of this in Ant?
You can run Ant in such a way that it's logging is via Log4j, there's an example in the Ant Listeners & Loggers page:
ant -listener org.apache.tools.ant.listener.Log4jListener
but see the Ant documentation for proper details, how to ensure log4j.properties etc. are found.