maven工程如果有jersey依赖,编译时经常遇到如下问题:
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: null:jersey-server:jar:null
Reason: Cannot find parent: com.sun.jersey:jersey-project for project: null:jersey-server:jar:null for project null:jersey-server:jar:null
解决步骤如下:
首先找到maven安装目录下的settings.xml文件,在其中添加如下镜像:
<mirror>
<id>jersey_workaround</id>
<mirrorOf>glassfish-repository</mirrorOf>
<name>Workaround for missing jersey-project.pom</name>
<url>http://repository.opencastproject.org/nexus/content/groups/public</url>
</mirror>
然后删掉.m2下已有的jersey目录:
rm -rf ~/.m2/repository/com/sun/jersey/
之后执行如下命令:
mvn clean install-DdeployTo=/opt/matterhorn/felix/matterhorn
这时再mvn compile应该可以了