java 不受支持的major.minor 版本52.0 - Maven 错误JAVA
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33168440/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Unsupported major.minor version 52.0 - Maven Error JAVA
提问by PRVS
I'm making
我在做
mvn install
安装
and i get the error:
我得到错误:
[ERROR] Failed to execute goal org.alfresco.maven.plugin:alfresco-maven-plugin:2.1.0:set-version (default-set-version) on project componentX-share: Execution default-set-version of goal org.alfresco.maven.plugin:alfresco-maven-plugin:2.1.0:set-version failed: Unable to load the mojo 'set-version' in the plugin 'org.alfresco.maven.plugin:alfresco-maven-plugin:2.1.0' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/alfresco/maven/plugin/VersionMojo : Unsupported major.minor version 52.0
[错误] 无法在项目 componentX-share 上执行目标 org.alfresco.maven.plugin:alfresco-maven-plugin:2.1.0:set-version (default-set-version):执行目标组织的默认设置版本.alfresco.maven.plugin:alfresco-maven-plugin:2.1.0:set-version failed: Unable to load the mojo 'set-version' in the plugin 'org.alfresco.maven.plugin:alfresco-maven-plugin: 2.1.0' 由于 API 不兼容:org.codehaus.plexus.component.repository.exception.ComponentLookupException:org/alfresco/maven/plugin/VersionMojo:不支持的major.minor 版本 52.0
But I already saw if the versions of java are equal, and it's correct.
但是我已经看到java的版本是否相同,并且是正确的。
Like:
喜欢:
which javac -> /usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/javac
which java -> /usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java
javac -> -version javac 1.7.0_79
java -> -version java version "1.7.0_79" OpenJDK Runtime Environment (IcedTea 2.5.6) (7u79-2.5.6-0ubuntu1.14.04.1) OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)
其中 javac -> /usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/javac
其中 java -> /usr/lib/jvm/java-1.7.0-openjdk-amd64/bin/java
javac -> -version javac 1.7.0_79
java -> -version java version "1.7.0_79" OpenJDK Runtime Environment (IcedTea 2.5.6) (7u79-2.5.6-0ubuntu1.14.04.1) OpenJDK 64-Bit Server VM (build 24.79-b02,混合模式)
and
和
mvn -v -> Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T12:57:37+01:00) Maven home: /home/patricia/Transferências/apache-maven-3.3.3 Java version: 1.7.0_79, vendor: Oracle Corporation Java home: /usr/lib/jvm/java-7-openjdk-amd64/jre Default locale: pt_PT, platform encoding: UTF-8 OS name: "linux", version: "3.19.0-25-generic", arch: "amd64", family: "unix"
mvn -v -> Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T12:57:37+01:00) Maven 主页:/home/patricia/3.09.apache-apache-aven/3.07m.37m.37.37n , 供应商:Oracle Corporation Java 主页:/usr/lib/jvm/java-7-openjdk-amd64/jre 默认语言环境:pt_PT,平台编码:UTF-8 操作系统名称:“linux”,版本:“3.19.0-25 -generic", arch: "amd64", family: "unix"
I think all it's correct. And my pom.xml:
我觉得都是对的。还有我的 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.acme</groupId>
<artifactId>componentX-share</artifactId>
<version>1.0-SNAPSHOT</version>
<name>componentX-share AMP project</name>
<packaging>amp</packaging>
<description>Manages the lifecycle of the componentX-share AMP (Alfresco Module Package)</description>
<parent>
<groupId>org.alfresco.maven</groupId>
<artifactId>alfresco-sdk-parent</artifactId>
<version>2.1.0</version>
</parent>
<!--
SDK properties have sensible defaults in the SDK parent,
but you can override the properties below to use another version.
For more available properties see the alfresco-sdk-parent POM.
-->
<properties>
<!-- The following are default values for data location and Alfresco version.
Uncomment if you need to change
<alfresco.version>${alfresco.community.default.version}</alfresco.version> -->
<!-- This control the root logging level for all apps uncomment and change, defaults to WARN
<app.log.root.level>WARN</app.log.root.level>
-->
<!-- Set the enviroment to use, this controls which properties will be picked in src/test/properties
for embedded run, defaults to the 'local' environment. See SDK Parent POM for more info.
<env>other environment name</env>
-->
<!-- The Maven artifact ID to use when loading the Share.WAR that the AMP should be applied to,
defaults to the alfresco.war artifact ID, so we need to override here. -->
<app.amp.client.war.artifactId>${alfresco.share.artifactId}</app.amp.client.war.artifactId>
<!-- Since Alfresco.WAR (i.e. the Repository) is already running on port 8080, we run Share.WAR on port 8081 -->
<maven.tomcat.port>8081</maven.tomcat.port>
<!-- Used in share-config-custom.xml. By default points to local installation of Alfresco Repo -->
<alfresco.repo.url>http://localhost:8080/alfresco</alfresco.repo.url>
<maven.compiler.target>1.7</maven.compiler.target>
<maven.compiler.source>1.7</maven.compiler.source>
</properties>
<!-- Here we realize the connection with the Alfresco selected platform
(e.g.version and edition) -->
<dependencyManagement>
<dependencies>
<!-- This will import the dependencyManagement for all artifacts in the selected Alfresco version/edition
(see http://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies)
NOTE: You still need to define dependencies in your POM, but you can omit version as it's enforced by this dependencyManagement. NOTE: It defaults
to the latest version this SDK pom has been tested with, but alfresco version can/should be overridden in your project's pom -->
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>alfresco-platform-distribution</artifactId>
<version>${alfresco.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- Following dependencies are needed for compiling Java code in src/main/java; -->
<dependencies>
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>share</artifactId>
<version>${alfresco.version}</version>
<classifier>classes</classifier>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.extensions.surf</groupId>
<artifactId>spring-surf-api</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<!-- Compress JavaScript files and store as *-min.js -->
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>yuicompressor-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<profiles>
<!--
Brings in the extra Enterprise specific share classes,
if the 'enterprise' profile has been activated, needs to be activated manually. -->
<profile>
<id>enterprise</id>
<dependencies>
<dependency>
<groupId>${alfresco.groupId}</groupId>
<artifactId>share-enterprise</artifactId>
<version>${alfresco.version}</version>
<classifier>classes</classifier>
<scope>provided</scope>
</dependency>
</dependencies>
</profile>
</profiles>
</project>
I already try to add lines to pom.xml like:
我已经尝试向 pom.xml 添加行,例如:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
that I saw in other solutions in "stackoverflow" but I can't solve the problem. I don't want to upgrade the version of Java (if it is the solution) I wanted to run in Java 7. Any idea?
我在“stackoverflow”的其他解决方案中看到的,但我无法解决问题。我不想升级我想在 Java 7 中运行的 Java 版本(如果它是解决方案)。知道吗?
If the solution is only upgrade for Java 8, say me too.
如果解决方案只是为 Java 8 升级,也请说我。
Thanks.
谢谢。
回答by Fran Montero
Your problem is that Maven Alfresco Plugin 2.1.0
requires JDK 1.8 as shown in the exception (version 52.0).
You can se requirements of the plugin here: Maven Alfresco PLugin Requirements
您的问题是Maven Alfresco Plugin 2.1.0
需要 JDK 1.8,如异常(版本 52.0)所示。您可以在此处设置插件的要求:Maven Alfresco PLugin Requirements
So your options are downgrade alfresco plugin version or upgrade to JDK 1.8.
所以你的选择是降级 alfresco 插件版本或升级到 JDK 1.8。
回答by Puce
Unsupported major.minor version 52.0
不支持的 Major.minor 版本 52.0
You need Java SE 8 or later.
您需要 Java SE 8 或更高版本。
回答by Sanjay Derangula
In your Project Settings change maven ----> Project Facedes---> Java 1.8 to 1.7.. and check your build path running on JRE or JDK... if JRE change to JDK...JavaPath in STS
在您的项目设置更改 maven ----> Project Facedes ---> Java 1.8 到 1.7.. 并检查您在 JRE 或 JDK 上运行的构建路径...如果 JRE 更改为 JDK... STS 中的 JavaPath