You have usage: findbugs-maven-plugin
<project>
[...]
<reporting>
[...]
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<xmlOutput>true|false</xmlOutput>
<xmlOutputDirectory>directory location of findbugs xdoc xml report</xmlOutputDirectory>
<threshold>High|Normal|Low|Exp|Ignore</threshold>
<effort>Min|Default|Max</effort>
<excludeFilterFile>findbugs-exclude.xml</excludeFilterFile>
<includeFilterFile>findbugs-include.xml</includeFilterFile>
<visitors>FindDeadLocalStores,UnreadFields</visitors>
<omitVisitors>FindDeadLocalStores,UnreadFields</omitVisitors>
<onlyAnalyze>org.codehaus.mojo.findbugs.*</onlyAnalyze>
<pluginList>/libs/fb-contrib/fb-contrib-2.8.0.jar</pluginList>
<debug>true|false</debug>
<relaxed>true|false</relaxed>
<findbugsXmlOutput>true|false</findbugsXmlOutput>
<findbugsXmlOutputDirectory>directory location of findbugs legact xml format report</findbugsXmlOutputDirectory>
</configuration>
</plugin>
[...]
</reporting>
[...]
</project>
But once:
mvn site
I get:
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
GroupId: org.codehaus.mojo
ArtifactId: findbugs-maven-plugin
Version: 1.2.1
Reason: Unable to download the artifact from any repository
org.codehaus.mojo:findbugs-maven-plugin:pom:1.2.1
from the specified remote repositories:
central (http://repo1.maven.org/maven2)
Do you know why? What should I do?
Looking at the repository, your version should be 1.2, not 1.2.1
Also, your configuration is wrong, you need to choose some of the options. So it should look like:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<threshold>High</threshold>
<effort>Default</effort>
</configuration>
</plugin>
try that:
<version>1.2</version>
http://repo2.maven.org/maven2/org/codehaus/mojo/findbugs-maven-plugin/
Seems like they did a simple copy/paste error.
The report will be in target/site. Look at the file index.html in a browser, than look for project reports, then findbugs report.
As part of your parent project structure place site.xml into parent-project/src/site:
|--- src
|---site
|---site.xml
An example site.xml from "Better Builds with Maven" (a free book available online) should get you started.
Once site.xml is created, execute mvn site from the parent project directory. It will pick up your reporting settings including the firebug report. Once the site is built, each child project will have directory /target/site, which contains index.html with a link to project reports. The project reports should contain firebug reports.
Related
I have a Maven 3.3 project, and the main output is a war file:
<artifactId>pro</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
I am using the maven plugin to also build a jar file, which goes into target/pro-1.0-SNAPSHOT.jar and this works.
I would like to install this jar to the local maven repo, so I'm using the maven install plugin to do this:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<classifier>jar</classifier>
<packaging>jar</packaging>
<file>target/pro-1.0-SNAPSHOT.jar</file>
</configuration>
<executions>
<execution>
<id>do-jar-install</id>
<phase>install</phase>
<goals>
<goal>install</goal>
</goals>
</execution>
</executions>
</plugin>
The whole build works fine except the jar install step is installing the war, and not the jar. How do I override this?
I'm looking here to see what I can use: http://maven.apache.org/plugins/maven-install-plugin/examples/installing-secondary-artifacts.html
Here is the log from my build:
**
Building jar: /Users/mike/code/workspace/pro/target/pro-1.0-SNAPSHOT.jar
[INFO] --- maven-install-plugin:2.5.2:install (do-jar-install) # pro
[INFO] Installing /Users/mike/code/workspace/pro/target/pro-1.0-SNAPSHOT.jar to /Users/mike/.m2/repository/net/mikeski/pro/1.0-SNAPSHOT/pro-1.0-SNAPSHOT.war
Note the last line - it's picking up the jar but installing a war
How can I fix that?
As requested, here is the jar plugin config:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>create-jar</id>
<phase>install</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
It creates a jar of the files in the project, and it's the correct jar. If I copy the war that is installed in my repo to a jar (so I just change the extension) my other project can pick it up just fine.
Your current output is the result of multiple considerations, one of them being maven-jar-plugin too permissive in version 2.4.
First of all, you need to remember that inside a Maven repository, all the artifacts share a single naming convention, which is artifactId-version(-classifier).packaging. This means that whatever the local name of the file your build is producing (let it be foo.jar), it will be installed and it will be deployed with this conventional name. All that matters when artifacts are installed are the Maven coordinates, i.e. the groupId, the artifactId, the version, the classifier and the packaging.
What is happening here is:
Your project has a packaging war. Running Maven with mvn install, the default-install phase will be invoked first and the maven-install-plugin:install goal will be run a first time, installing your WAR project. On your logs, you will find:
[INFO] --- maven-install-plugin:2.5.2:install (default-install) # test-war ---
[INFO] Installing ...\test-war\target\test-war-0.0.1-SNAPSHOT.war to ...\test-war\0.0.1-SNAPSHOT\test-war-0.0.1-SNAPSHOT.war
[INFO] Installing ...\test-war\pom.xml to ...\test-war\0.0.1-SNAPSHOT\test-war-0.0.1-SNAPSHOT.pom
Then, you are using the maven-jar-plugin:jar goal to create a JAR. This plugin creates a JAR for the current Maven project - so it will create it alright, but the Maven coordinates of this new artifact will be exactly the same as those of your WAR project (you didn't specify a classifier). Therefore, you effectively replace the file of the main artifact (which is a WAR), by a JAR file: you end up with a local file having an extension of jar (because the maven-jar-plugin created it this way) that is the file of the main artifact of a Maven project of packaging war. Quite confusing.
Remember that I said that the maven-jar-plugin was too permissive? If you update to version 3.0.2 of the plugin, you will get an error right here (MJAR-198):
You have to use a classifier to attach supplemental artifacts to the project instead of replacing them. -> [Help 1]
which summarizes what is said above.
Finally, you declared another execution of the maven-install-plugin called do-jar-install, that is supposed to install this local JAR file. And this is what it does: it installs the local JAR file inside your target folder to your local Maven repository using the coordinates of the artifact. The confusion comes from the fact that the type (packaging) of the artifact is in fact WAR, so what gets installed is a WAR file (being effectively a JAR)...
Now that we've explained the issue, the question is: what do you want to do? It looks like you want to attach to your WAR project an additional artifact composed of the classes of it. There is no need for all this configuration, you can just use the attachClasses parameter of the maven-war-plugin.
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<attachClasses>true</attachClasses>
</configuration>
</plugin>
You received this because double invocation of plugin :
execution phase
package - default phase
If there is no strong reason and all you care is to have just one JAR as artifact from the project, use one among them.
something like :
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.6</version>
<configuration>
<outputDirectory>${outputDirectory}</outputDirectory>
</configuration>
</plugin>
I have created a maven android project using this archetype. I want to integrate mirah source files inside my project. So I added the plugin mentioned here to my pom.xml. I setup the configuration section for the plugin to point the source directory to src/main/mirah.
But when I run mvn compile it only compiles the sources inside src/main/java. I have tried running it with mvn -X compile to try and debug the issue, but I can't find anything related to mirah or the mirah-maven-plugin there.
Using the archetype it created two projects - project and project-it (tests) , there is a pom.xml in the root directory as well as a pom.xml in project and project-it directories. I have tried the above configurations in both the root directory as well as in project's pom.xml.
I have come across this question related to using the build-helper plugin but I don't know if it will help in my case. Since my mirah plugin isn't getting called at all.
Is this the right way to do what I'm trying to do? Any help on the setup, or pointer to how to troubleshoot this would be much appreciated.
The relevant bit of my pom.xml
<plugin>
<groupId>org.mirah.maven</groupId>
<artifactId>maven-mirah-plugin</artifactId>
<version>1.0</version>
<configuration>
<sourceDirectory>src/main/mirah</sourceDirectory>
<outputDirectory>target/classes</outputDirectory>
<bytecode>true</bytecode>
<verbose>false</verbose>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals><goal>compile</goal></goals>
</execution>
</executions>
</plugin>
Edited as per answer below.
I have added the source directory using the build-helper plugin and I'm able to get the mirah sources to compile using mvn org.mirah.maven:maven-mirah-plugin:1.0:compile from the answer below. But mvn compile still only compiles the sources in src/main/java and not src/main/mirah.
For anyone interested in the output of mvn -X compile here is the pastie.
This page https://github.com/calavera/maven-mirah-plugin#readme says that the mirah plugin extends the default compiler plugin. So this would suggest that the build helper plugin would work for multiple source directories, if it works for the default compiler plugin.
Looking at the mirah plugin, you probably don't need to specify sourceDirectory and outputDirectory yourself, as it seems you're using the defaults.
The -X switch won't have any impact on the mirah plugin directly, as it doesn't do any tracing itself (above what the default compiler plugin does).
Can you show your -X output anyway to show that the mirah plugin isn't invoked?
Alternatively, you could build the mirah plugin yourself and add tracing. It doesn't seem a complicated plugin.
What happens when you try and invoke the plugin directly? E.g.
mvn org.mirah.maven:maven-mirah-plugin:1.0:compile
EDIT:
Tried it myself and this works for me (by 'works' I mean the plugin gets invoked - my build actually fails).
<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>temp</groupId>
<artifactId>temp</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.mirah.maven</groupId>
<artifactId>maven-mirah-plugin</artifactId>
<version>1.0</version>
<configuration>
<bytecode>true</bytecode>
<verbose>true</verbose>
</configuration>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
With this output:
D:\dev\workspaces\3.6\temp>mvn compile
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - temp:temp:jar:0.0.1-SNAPSHOT
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] [compiler:compile {execution: default-compile}]
[INFO] Nothing to compile - all classes are up to date
[INFO] [mirah:compile {execution: default}]
[INFO] No sources to compile
Parsing...
D:\dev\workspaces\3.6\temp\src\main\mirah/test.mirah
Inferring types...
* [Mirah::Typer] Learned local type under #<Mirah::AST::StaticScope:0xbc5245> : a = Type(int)
... ETC ...
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Unknown error - Unknown Error (20047) - D:\dev\workspaces\3.6\temp\target\classes\D:
I don't know what the error means as I'm not a mirah user.
I'm trying to get maven site working, but I'm blocked on this error.
[INFO] Failed to resolve artifact.
Failed to resolve artifact, possibly
due to a repository list that is not
appropriately equipped for this
artifact's metadata.
org.apache.maven.plugins:maven-pmd-plugin:pom:2.6-SNAPSHOT
from the specified remote
repositories: sonar
(http://sonar:9000/deploy/maven),
central
(http://repo1.maven.org/maven2),
risk-idi
(http://nexus.yyy.com/nexus/content/groups/public-all)
I'm using maven 2.2.1 and maven site plugin version 2.2.
Any help will be appreciated.
I've found no maven-pmd-plugin-2.6-SNAPSHOT in the official maven repository (proof). You can try to specify its version explicitly:
<project>
...
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>2.5</version>
</plugin>
</plugins>
</reporting>
...
</project>
Configuration is taken from here.
I'm attempting to create a basic maven site using the maven site plugin. So I added this to my pom:
<reporting>
<plugins>
<!--JavaDoc setup-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<defaultAuthor>Leon Blakey</defaultAuthor>
<defaultVersion>${project.version}</defaultVersion>
<links>
<link>http://download.oracle.com/javase/6/docs/api</link>
</links>
</configuration>
</plugin>
</plugins>
</reporting>
And ran mvn site --errors
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building pircbotx 1.3-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-site-plugin:2.0.1:site (default-site) # pircbotx ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.688s
[INFO] Finished at: Wed Jan 12 18:08:00 EST 2011
[INFO] Final Memory: 5M/13M
[INFO] ------------------------------------------------------------------------
W:\programming\pircbot-hg>
Hmm, odd that there's no output. So when I check target/site, its empty. The only folders are images/ , css/ , and WEB-INF/ , filled with some generic pictures. No javadoc and no site.
This is reproducible with mvn site:site and mvn org.apache.maven.plugins:maven-site-plugin:2.2:site (apparently maven only wants to use 2.0.1 by default)
Whats strange is that I can go back to maven 2.2.1 and successfully generate a site. But when I use 3.0.1-RC1 (happens to come with Netbeans), it fails.
What am I doing wrong that would make the site plugin fail in 3.0.1 but not 2.2.1?
Perhaps you can try using Maven Site Plugin 3.x. You can do that by adding the following in your pom.xml
<build>
...
<plugins>
...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0-beta-3</version>
</plugin>
</plugins>
</build>
I was having the same problem. I found a blog post about the topic.
Quoting the blog (emphasis mine):
If you have been using the reporting section of the pom.xml file to generate code quality metrics, javadoc reports, and so forth, you may have a little work to do to migrate this feature into Maven 3. Indeed, the reporting and reportSets sections have been deprecated (it won't cause an error with Maven 3, it will just be ignored), and have been replaced by a reportPlugins section in the configuration block of the maven-site-plugin itself.
Ignoring the old <reporting> without any warning about it being deprecated seems a bit rude, but anyway...
So you are basically just moving your old reporting plugins into the configuration section of the new maven-site-plugin.
A section of the maven-plugin-site explains that they removed of all reporting logic from the core of Maven to "decouple the Maven core from Doxia and to allow arbitrary reporting systems to be developed." Makes sense.
Use of the Site Plugin ( http://maven.apache.org/plugins/maven-site-plugin/ ) with Maven 3 finally seems to be resolved. The (non-beta) version has been released, and the ability to use the version 2 style <reporting> structure in the pom.xml declaration has been added back.
Although it is (as usual) hard to navigate the substantial but unorganized and overlapping documentation about Maven 3 and the site plugin, one page - http://maven.apache.org/plugins/maven-site-plugin/maven-3.html - states that the old style is now recommended over the new "plugin to site plugin" style:
Note: In Maven 3, the new format does not support report plugins configuration inheritance: see MSITE-484. This format was technically necessary to remove reporting logic from Maven 3, but a new inheritance mechanism still needs to be added to Maven 3 to make it as flexible as the old format. So the new format is not ready for direct use for now.
The example page http://maven.apache.org/plugins/maven-site-plugin/examples/configuring-reports.html for configuring reports doesn't even mention the "new" formatting method.
Not sure if this is in a "best practice" form, but an example pom reporting section that works for me with a couple of extra reports is as follows; select your own plugins as desired.
...
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.0</version>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<!-- Default Site Pages -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.4</version>
</plugin>
<!-- Java Documentation -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
</plugin>
<!-- Source Code Cross-Reference -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>2.3</version>
</plugin>
...
</plugins>
</reporting>
As an aside, If you use the m2e plugin in Eclipse to edit your POMs, then you can use code completion in the version section of a plugin to give you a list of its current versions. Very handy.
When i try to run jetty maven plugin(mvn jetty:run) I have received this error:
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
D:\projects\Projekt\src\main\java\Runner.java:[18,22] package org.apache.uima does not exist
This package use class Runner, and it seems that it was not found, how can i add it?
I have tried to use <webAppConfig>, but it doesn't help...
Update2: Uima is now available in a publicly available Maven repo, no need to configure your repository list.
Update: Uima is available on the Apache's m2 http://people.apache.org/repo/m2-incubating-repository. You'll need to configure your settings to reference the repository and add the dependency(ies) to your pom.
The dependency for uima-core looks like this:
<dependency>
<groupId>org.apache.uima</groupId>
<!--note there are several other uima jars you may want to reference-->
<artifactId>uimaj-core</artifactId>
<version>2.4.0</version>
</dependency>
<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>9.4.5.v20170502</version>
<configuration>
<httpConnector>
<port>9999</port>
</httpConnector>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>