Since this night, maven site 3.3 plugins stop to work.
Try to delete local repository, but no change.
Maven 3.3.9
java 1.8
No config or dependencies defined in pom for site plugins
[WARNING] Error injecting: org.apache.maven.report.projectinfo.CiManagementReport
java.lang.NoClassDefFoundError: org/apache/maven/doxia/siterenderer/DocumentContent
I had just started to get this issue also during builds. What worked for me was to specifically define the maven-site-plugin and the maven-project-info-reports-plugin along with the version numbers in the pom.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
This is caused by maven-project-info-reports-plugin updated to 3.0.0, and rely on doxia-site-renderer 1.8 (and have org.apache.maven.doxia.siterenderer.DocumentContent this class), but maven-site-plugin:3.3 rely on doxia-site-renderer:1.4 (and do not have org.apache.maven.doxia.siterenderer.DocumentContent)
We can specific maven-project-info-reports-plugin version in reporting part:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.9</version>
</plugin>
</plugins>
</reporting>
Or we can specify maven-site-plugin to the latest 3.7.1 like:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
in build part of pom.
Version of the maven site plugin needs to be explicitly set in the build section too. Here is the example:
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
<reportSets>
<reportSet>
<reports>
<report>index</report>
<report>licenses</report>
<report>dependency-info</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
<build>
<plugins>
<!-- Part of Maven - specified version explicitly for compatibility
with the maven-project-info-reports-plugin 3.0.0-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
</plugins>
</build>
Maven 3 doesn't support Doxia anymore.
Use
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.2</version>
</plugin>
Reference: https://maven.apache.org/plugins/maven-site-plugin/maven-3.html
You really need to add more information (I didn't downvote BTW).
IIRC; if you don't specify a version for a plugin bound to lifecycle phases, you'll get the latest.
Try:
Upgrading to the latest version of maven - 3.5.4 ATOW
Running mvn help:effective-pom and checking which versions are
actually being resolved - if you have an old log from CI or wherever
to compare with..
Explicity setting the maven-site-plugin version
in pluginManagement section
Adding a dependency to maven-site-plugin (see below)
org/apache/maven/doxia/siterenderer/DocumentContent can be found in doxia-site-renderer:
<dependency>
<groupId>org.apache.maven.doxia</groupId>
<artifactId>doxia-site-renderer</artifactId>
<version>1.8.1</version>
</dependency>
I suspect explicitly setting the version of maven-site-plugin to whatever you used to use (incidentally) will work.
Edit: Was chasing a similar issue in maven plugin build testing, explicitly setting maven-site-plugin version (3.7.1 ATOW) in integration pom used by maven-invoker-plugin has worked for me.
The following versions in pom.xml fixed the problem for me:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>3.7</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.9</version>
</plugin>
I also hit this error on some of my build jobs today. The fix suggested above, adding a concrete dependency for the maven-site-plugin does work and fixes this issue.
However, what it highlighted for me was the fact I was even running the mvn site goal, which I didn't even know we were running and we don't really require.
My fix was to therefore remove the site goal from my mvn arg, as although the site it creates is actually quite useful, I never knew we were creating it, we never published it anywhere and were actually deleting it every build anyway.
I tried to follow Changhua's advice, and define maven-project-info-reports-plugin to version 3.0.0, and maven-site-plugin to 3.7.1 in my pom file, but found that the maven site still pulled in version 3.3 of the maven-site-plugin, regardless of how I set it.
I finally realized that my problem had to do with our project structure. We have a parent pom, in which we were defining the maven-site-plugin dependency, which was then inherited by the children poms. However, the build pom file was separate, and didn't define maven-site-plugin at all, which allowed maven to pull in the 3.3 version on its own. I added the maven-site-plugin dependency (version 3.7.1) to the build pom file, so that it now exists in both the build pom file and the parent pom file, and now the build is correctly using version 3.7.1, and is passing again.
I build my project with mvn clean install, however I want to generate a subfolder in the target folder and put the generated jar file in there. I saw these two questions Maven: specify the outputDirectory only for packaging a jar? and maven: how to place the output jar into another folder however their answer doesn't seem to work.
This is how my maven build looks like:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<outputDirectory>${project.build.directory}/blah</outputDirectory>
</configuration>
</plugin>
</plugins>
</build>
However I get the .jar file still in target directory. I also noticed that the project packaging is set as <packaging>eclipse-plugin</packaging> if I change this to jar, then it works fine, however I do need it to be eclipse-plugin. I am also using tycho for the eclipse plugin. Am I missing something that was not mentioned before?
From your packaging of eclipse-plugin I'm guessing you're using Tycho. Tycho doesn't seem to use any of the maven plugins, so configuring the maven-jar-plugin isn't going to help. Instead try configuring the tycho-packaging-plugin, specifically the buildDirectory property:
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-packaging-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<buildDirectory>${project.build.directory}/blah</buildDirectory>
</configuration>
</plugin>
What I do is:
Create a new project with IntelliJ with Maven module.
Add Framework support to this project and pick: JSF.
Go to pom.xml and add: packaging: war.
And from Maven window in IntelliJ I click: Clean Install.
Well build fails, because maven is looking for a webapp directory instead of a directory called web. For building the project.
So, if I rename the folder web to webapp build goes fine.
However, I want to learn more about IntelliJ and maven, so I want to force maven to use the folder web. How can I properly do this
Using the command line? I mean without invvolving IntelliJ at all?
Using Intellij?
Regards.
You can configure this in the pom.xml file for your project.
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<warSourceDirectory>web</warSourceDirectory>
</configuration>
</plugin>
</plugins>
You can find the documentation here
If IntelliJ behaves as expected, it should pick up this new configuration.
Have a look at this post, which explains how to change the default webapp directory:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<warSourceDirectory>web</warSourceDirectory>
</configuration>
</plugin>
</plugins>
</build>
I've got the maven-enunciate-plugin integrated so that it generates documentation during the build and outputs it to the docs directory under the target directory. As I'm new to Maven I would like to know what would be the ideal way to configure my build so that it packages the docs directory into the WAR artifact of my build. Currently it is left outside of the WAR.
Thanks,
Mike
Please take a look at this and this
<project>
...
<build>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<!--
Exclude JCL and LOG4J since all logging should go through SLF4J.
Note that we're excluding log4j-<version>.jar but keeping
log4j-over-slf4j-<version>.jar
-->
<packagingExcludes>
WEB-INF/lib/commons-logging-*.jar,
%regex[WEB-INF/lib/log4j-(?!over-slf4j).*.jar]
</packagingExcludes>
<packagingIncludes>
**/docs
</packagingIncludes>
</configuration>
</plugin>
</plugins>
</build>
...
</project>
Well I'm running Eclipse with Tomcat runtime environment (it is run from Eclipse) and I've recently turned my web project to Maven project. Now it finally compiles well, however when I try running it on server it doesn't seem to load the compiled classes and hibernate configuration files to the Tomcat working directory in :
**D:\Dropbox\EclipseWorkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\myProject**
So I have to copy all the compiled classes and practically all the missing files manually everytime I now change anything...
Can I change anything in Eclipse settings? Also where should I output my compiled classes from Maven? At the moment the build in pom.xml looks like this:
<build>
<sourceDirectory>src/</sourceDirectory>
<directory>${basedir}/build</directory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
Can anyone help me with this? Thanks in advance.