Maven版本问题

时间:2015-07-30 13:09:15

标签: java maven

我正在尝试测试一个maven项目,但我一直收到这个错误...任何想法? 我的Java版本是" 1.7.0_80" 欢迎所有建议..

/usr/lib/jvm/java-7-oracle/bin/java -Dmaven.home=/usr/share/maven2 -Dclassworlds.conf=/usr/share/maven2/bin/m2.conf -Didea.launcher.port=7541 -Didea.launcher.bin.path=/opt/idea/bin -Dfile.encoding=UTF-8 -classpath /usr/share/maven2/boot/classworlds.jar:/opt/idea/lib/idea_rt.jar com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher -Didea.version=13.1.4 --no-plugin-registry test
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.rancard.kudi:kudi-client:jar:1.0-SNAPSHOT
[INFO]    task-segment: [test]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: org.glassfish.jersey:project

Reason: Invalid JDK version in profile 'jdk1.7+': Unbounded range: [1.7, for project org.glassfish.jersey:project


[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1 second
[INFO] Finished at: Thu Jul 30 12:42:53 GMT 2015
[INFO] Final Memory: 14M/172M
[INFO] ------------------------------------------------------------------------

Process finished with exit code 1

这是我从命令行构建的结果......它标记了同样的错误......

rancard@RSL-PROD-INT1 ~/IdeaProjects/kudi/client $ mvn package 
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building Unnamed - com.rancard.kudi:kudi-client:jar:1.0-SNAPSHOT
[INFO]    task-segment: [package]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).


Project ID: org.glassfish.jersey:project

Reason: Invalid JDK version in profile 'jdk1.7+': Unbounded range: [1.7, for project org.glassfish.jersey:project


[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5 seconds
[INFO] Finished at: Thu Jul 30 15:35:39 GMT 2015
[INFO] Final Memory: 14M/108M
[INFO] ------------------------------------------------------------------------

这是我的pom文件的内容

<?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">
    <parent>
        <artifactId>kudi-platform</artifactId>
        <groupId>com.rancard.kudi</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>kudi-client</artifactId>
    <packaging>jar</packaging>

    <dependencies>  
        <dependency>
            <groupId>com.rancard.kudi</groupId>
            <artifactId>kudi-domain</artifactId>
            <version>1.0-SNAPSHOT</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>javax.ws.rs</groupId>
            <artifactId>javax.ws.rs-api</artifactId>
            <version>2.0.1</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.bundles</groupId>
            <artifactId>jaxrs-ri</artifactId>
            <version>2.19</version>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.core</groupId>
            <artifactId>jersey-client</artifactId>
            <version>2.19</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.glassfish.jersey.media</groupId>
            <artifactId>jersey-media-json-jackson</artifactId>
            <version>2.19</version>
        </dependency>
    </dependencies>

    <build>   
        <plugins>
            <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>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.7</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>2.18.1</version>
            </plugin>
        </plugins>
    </build>

</project>

2 个答案:

答案 0 :(得分:2)

安装maven 2.0.6时遇到了同样的问题 运行mvn -version并检查你有正确的maven版本,它应该如下所示:
    Apache Maven 3.0.4
    Maven home:/ usr / share / maven

答案 1 :(得分:0)

我的猜测是,glassfish jersey依赖项的pom具有在使用某个jdk版本时激活的配置文件。但是JDK版本的声明格式不正确。

见下文:(http://central.maven.org/maven2/org/glassfish/jersey/project/2.19/project-2.19.pom

<profile>
    <id>jdk1.7+</id>
    <activation>
        <jdk>[1.7,</jdk>
    </activation>
...
</profile>