maven site plugin is not working well behind a proxy - java

I'm using maven (apache-maven-3.2.1) and maven-site-plugin into my project.
while doing mvn site behind a proxy I got the following warnings / slowness :
[INFO] Rendering site with org.apache.maven.skins:maven-default-skin:jar:1.0 skin.
[INFO] Generating "Dependencies" report --- maven-project-info-reports-plugin:2.8:dependencies
[WARNING] The repository url 'http://download.oracle.com/maven' is invalid - Repository 'oracle.releases' will be blacklisted.
[WARNING] The repository url 'http://snapshots.repository.codehaus.org' is invalid - Repository 'codehaus-snapshots' will be black
listed.
[WARNING] The repository url 'http://repository.codehaus.org' is invalid - Repository 'codehaus' will be blacklisted.
[WARNING] The repository url 'http://download.java.net/maven/glassfish' is invalid - Repository 'glassfish-repository' will be bla
cklisted.
[WARNING] The repository url 'http://download.java.net/maven/2/' is invalid - Repository 'maven2-repository.dev.java.net' will be
blacklisted.
I got a build success but I think that blacklisting a valid repository is an issue...
I'm behind a proxy so I defined a proxy into my maven global settings ($M2_HOME/conf/settings.xml).
For some plugins like release-plugin (cf example under) or surefire-plugin I had to override arguments with proxy settings to get a success build, but I din't find an arguments (equivalent configuration) for maven-site-plugin.
maven-release example behind a proxy
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.2</version>
<configuration>
<arguments>${proxyString}</arguments>
</configuration>
</plugin>
(...)
<profile>
<id>proxy</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<properties>
<proxyString>-Djava.net.useSystemProxies=true
-Dhttp.proxyHost=myProxy -Dhttp.proxyPort=3128
-Dhttps.proxyHost=myProxy -Dhttps.proxyPort=3128</proxyString>
</properties>
</profile>
I think that maven site use maven-project-info-reports-plugin but I don't know how to pass proxy arguments to this plugin (which is -according to the doc- configured internally by maven-site) ?
I saw an old discussion on apache maven mailing list but that doesn't help me.
How to set a proxy for mvn site ?

Logs are listing deprecated, moved or inexisting repositories, so this warning are expected.
As this step could be really really slow, ( via this src ) there is a way to avoid generating dependencies locations:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
</configuration>
</plugin>
</plugins>
</pluginManagement>

Related

POM for Maven Compiler Plugin Jar is missing

EDIT: I've just updated my Eclipse installation from Kepler to Luna - all of my Maven projects were running fine before the update
I am receiving the error which is preventing my Maven project from installing:
The POM for org.apache.maven.plugins:maven-compiler-plugin:jar:2.5.1 is missing, no dependency information available
And when I navigate to Maven's Lifecycle Mapping in Eclipse I see
compiler:compile | error
compiler:text Compile | error
I have maven-compiler-plugin:jar:3.1 (including the POM file) in my .m2 repository and would like to use that instead.
How could this be configured in Eclipse? Alternatively, if this is not the solution to the problem, how could this be resolved?
You need to edit your pom.xml to set the version of the compiler plugin to be used. As described on the plugin's homepage, you configure the maven-compiler-plugin in the build-section of your project's pom.xml like so:
<project>
...
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<!-- put your configurations here -->
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
...
</project>
If you want to use the local repository of your Maven installation (instead of Eclipse's embedded version), go to Preferences -> Maven -> Installations and add your Maven installation there.

Error when deploying site of a maven multi module project with FTP

I have a multi module project. When I launch mvn site:deploy, the deployment of the base module works fine, but it fails to create the directory of the module sites on the FTP server:
[INFO] Error uploading site
Embedded error: Required directory: '/myremoteftprepository/myproject-mymodule' is missing
When I create the missing directory by hand, it works fine, but I would like to avoid that. It is surprising that the deploy command do not create it. Do you how to force this directory creation? Is it a bug in the wagon-ftp plugin?
FYI, here is my POM:
<build>
<extensions>
<!-- Enabling the use of FTP -->
<extension>
<groupId>org.apache.maven.wagon</groupId>
<artifactId>wagon-ftp</artifactId>
<version>1.0</version>
</extension>
</extensions>
</build>
I have chosen to include the javadoc with:
<reporting>
<plugins>
<!-- include javadoc in the site -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.8</version>
<configuration>
<show>public</show>
</configuration>
</plugin>
</plugins>
</reporting>
and
<distributionManagement>
<site>
<id>site</id>
<name>maven site</name>
<url>ftp://ftp.blabla.org/myremoteftprepository</url>
</site>
</distributionManagement>
and my settings.xml is good.
You should not launch the site:deploy goal, but rather the site-deploy Maven lifecycle phase e.g. like that
mvn clean install site-deploy
and also make sure that the latest version of your wagon transport is used (2.2).
Also for javadoc plugin you should configure it as reporting plugin under the configuration of the maven site plugin.
With the most recent version of wagon-ftp (2.2), it works.

Maven site command fails

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.

Maven site (Maven 3) generates empty site folder

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.

Maven FindBugs plugin

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.

Categories

Resources