使用maven无界JDK构建Jersey



我正在用Jerseymaven构建一个web服务。执行mvn package时,我收到以下错误:

[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to resolve artifact.
Unable to get dependency information: Unable to read the metadata file for artifact 'org.glassfish.hk2.external:javax.inject:jar': Invalid JDK version in profile 'javadoc-jdk8+': Unbounded range: [1.8 for project unknown:hk2-parent
  org.glassfish.hk2.external:javax.inject:jar:2.4.0-b31
from the specified remote repositories:
  central (http://repo1.maven.org/maven2)
Path to dependency: 
1) com.rhcloud.susudev.tapapp:tapapp-service:jar:1.0-SNAPSHOT
2) org.glassfish.jersey.containers:jersey-container-grizzly2-http:jar:2.22.1

pom.xml

<project>
...
    <build>
    <plugins>
        <!-- download source code in Eclipse, best practice -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-eclipse-plugin</artifactId>
            <version>2.9</version>
            <configuration>
                <downloadSources>true</downloadSources>
                <downloadJavadocs>false</downloadJavadocs>
            </configuration>
        </plugin>
        <!-- Set a compiler level -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5.1</version>
            <inherited>true</inherited>
            <configuration>
                <source>${jdk.version}</source>
                <target>${jdk.version}</target>
            </configuration>
        </plugin>
        <!-- Make this jar executable -->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-jar-plugin</artifactId>
            <configuration>
                <archive>
                    <manifest>
                        <mainClass>com.rhcloud.susudev.tapapp.Main</mainClass>
                    </manifest>
                </archive>
            </configuration>
        </plugin>
        <!-- Includes the runtime dependencies -->
        <plugin>
            <groupId>org.dstovall</groupId>
            <artifactId>onejar-maven-plugin</artifactId>
            <version>1.4.4</version>
            <executions>
                <execution>
                    <goals>
                        <goal>one-jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
<!-- One-Jar is in the googlecode repository -->
<pluginRepositories>
    <pluginRepository>
        <id>onejar-maven-plugin.googlecode.com</id>
        <url>http://onejar-maven-plugin.googlecode.com/svn/mavenrepo</url>
    </pluginRepository>
</pluginRepositories>
<properties>
    <jersey.version>2.22.1</jersey.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <jdk.version>1.7</jdk.version>
</properties>

我该怎么修?

打开2.4.0-b31.pom,找到配置文件"javadoc-jdk8+",并将值更改为[1.8,)

使用maven 3,我得到了与maven 2 相同的错误

将jersey版本升级到2.25.1解决了问题,2.22.1有一个糟糕的清单。

最新更新