After I upgraded my Ubuntu to 13.10 version I reinstalled the latest Eclipse Kepler.
I have a simple JSE app. It used to work in Eclipse before and it's still working through terminal (mvn clean install), but now I'm getting an error in Eclipse:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.3.2:jar
(default-jar) on project files: Execution default-jar of goal org.apache.maven.plugins:maven-jar-plugin:2.3.2:jar
failed: Unable to load the mojo 'jar' in the plugin 'org.apache.maven.plugins:maven-jar-plugin:2.3.2'.
A required class is missing: org.apache.maven.plugin.jar.JarMojo
I already tried a few things:
- I checked jvm version configured in eclipse.ini: -vm /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java
- I tried 3.0.5 and 3.1.1 maven versions;
- I right-clicked the project and selected Maven->Update Project.
- I checked the java version in the project properties menu: it's pointing to /usr/lib/jvm/java-6-openjdk-amd64, although it always changes back to JavaSE-1.6(jre6) after I follow the previous step (Update Project).
- Set java source and target version to 1.6 in the maven-compiler-plugin in pom.xml configuration.
- Tried different jdk versions (openjdk6, openjdk7, oracle jdk6 and oracle jdk7);
- I also tried to download JBoss Devstudio and also cleaning workspace by deleting .metadata folder.
Unfortunately nothing worked.
This is my pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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>br.uel.ati.util</groupId>
<artifactId>files</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>jse-template</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<description>Template da Diretoria de Desenvolvimento de Sistemas para bibliotecas utilizadas por projetos EJB e Web.</description>
<organization>
<name>Universidade Estadual de Londrina</name>
<url>http://uel.br/ati</url>
</organization>
</project>
Anyone know what I should try to solve this issue?
I found the solution here: How can i resolve plugin problem in maven:' Unable to load mojo'
Apparently there was a corrupted library in maven repository. I just deleted repository/org folder, download it again and updated (Maven->Update Project + F5) my maven projects inside Eclipse.
I'm still curious about why it was working by command line. Maybe a new maven repository was created when I installed it by apt-get.