开发者

org/codehaus/plexus/archiver/jar/JarArchiver (Unsupported major.minor version 49.0) - Maven build error

Afternoon all,

I am receiving the above error when trying to build my project. I'm pretty sure this has something to do with Maven's latest update being compiled using Java 1.6 and the proje开发者_JS百科ct we are trying to build is a 1.4 project. The plugin prior to this worked without problems, so I have added the following to the POM.xml file to try to force the existing plugin to be used.

    <dependency>
        <groupId>org.codehaus.plexus</groupId>
        <artifactId>plexus-archiver</artifactId>
        <version>1.2</version>
    </dependency>

But it continues to fail.

Any help would be much appreciated

Thanks


Try to add the following plugin for maven. It works for me:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-jar-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
        <encoding>UTF-8</encoding>
    </configuration>
</plugin>


The error you are experiencing means that org/codehaus/plexus/archiver/jar/JarArchiver was compiled against Java 1.5 whilst you are trying to load using older Java version.

1.2 version of plexus-archiver works under Java 1.4. However 2.0 requires Java 1.5. Are you sure you are using 1.2?

If this is a plugin, it should be defined under <plugins>.


Use:

   <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.4</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>


I was getting this error till I changed my maven-source-plugin version to 2.2.1. I was getting the error with 2.1.1.


Including the 'old' version of a plugin in the pom.xml is solving part of the problem. you also need to make sure you are using the right jvm to match.

For a current project i'm working on I had to set JAVA_HOME to java 1.4 with maven 2.0.8. Problem with maven is that it looks for updates in the local and remote repositories (if there is a remote repository set in the maven settings.xml), than tries use version 2.5 for the 'clean' and 'install' plugins for example causing the major.minor 49.0 error (clean and install plugins version 2.5 are compiled with java 1.5 or greater while I tried to execute them in a java 1.4 environment).

With adding in the plugin snippet in the pom.xml of the project forcing it to use version 2.2 combined with the old java version on my path:

(set path=c:\youroldjavadirectory\bin;c:\youroldmavendirectory\bin) everything started working.

Check versions of java before running the maven command:

java -version

mvn -v


According to Fred from the m2e-mailing list, this has been fixed with m2eclipse-mavenarchiver 0.17.0. You can install it from http://repo1.maven.org/maven2/.m2e/connectors/m2eclipse-mavenarchiver/0.17.0/N/LATEST/

Just add the repo as an update site, and then upgrade the mavenarchiver component.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜