POM for Maven Compiler Plugin Jar is missing - java

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.

Related

Java Maven project creating failed in ecilipse

when I am creating new maven project in eclipse, it failed to create project.
its about dependencies.. I am uploading screen shot
I am creating project with jar packaging.
What could be the reason?
Try to do these steps:
1: Delete .M2 Content 2
3: Close Eclipse..and reopen
4: clean and update project configuration
5: verify the java buld path used for the project configuration
6: Try use the Maven embedded in eclipse just for a test, to see if the problem is the external Maven installation corrupted
Ensure you have declared your maven resource plugin correctly in your pom.xml and also post your pom.xml for other users to see.
<build>
<pluginManagement>
<plugins>
<plugin>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</dependency>
</plugin>
</plugins>
</pluginManagement>
</build>

Maven changing output directory for jar doesn't work

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>

How to tell IntelliJ to use folder "web" instead of "webapp" for maven when building a war file?

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>

"maven-resources-plugin prior to 2.4 is not supported by m2e"

I'm having problems with m2e (Maven plugin into Eclipse IDE).
I see the following error:
maven-resources-plugin prior to 2.4 is not supported by m2e. Use maven-resources-plugin version 2.4 or later.
I have no idea how to resolve this error. I'm pretty sure it is an m2e issue (maybe a setup thing?).
Background:
I'm attempting to build Tika v0.9
http://svn.apache.org/repos/asf/tika/tags/0.9/
I can build using Maven from command line.
I can build using Netbeans v7.0.1.
I am running Maven 3.0.3.
I am running Eclipse Indigo Service Release 1 (Build id: 20110916-0149)
I am running m2e v1.0.100.20110804-1717
Thanks for any help.
Albert
In the tika.parent project you can find org.apache.apache.6 as parent:
<parent>
<groupId>org.apache</groupId>
<artifactId>apache</artifactId>
<version>6</version>
<relativePath />
</parent>
And in the pom.xml from org.apache apache you can find:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.3</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
First simple solution:
add the following into the pom of tika.parent under "build - pluginManagement - plugins" (line 230):
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.5</version>
<configuration>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
...
And then ask the tika team to use a newer org.apache apache parent pom.
How did you import your project into eclipse? (the mvn eclipse:eclipse goal, or "import maven project" in Eclipse?)
Maybe this answer is of relevance: Error in POM.xml
Another solution which worked for me is :
1) Uninstall all the existing Maven plugins from Ecplise.
2) Then install Maven plugin from this location : http://m2eclipse.sonatype.org/sites/m2e
-Rushi

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.

Categories

Resources