Reputation: 5384
Have Eclipse Juno, maven 2.2.1, and m2eclipse running on a Red Hat Linux platform...
Downloaded a simple example to build a Restful Hello World web service (which works on my OS X computer) but for some odd reason, its not working on my Linux box.
Here's the pom.xml:
<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.mkyong.common</groupId>
<artifactId>RESTfulExample</artifactId>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<name>RESTfulExample Maven Webapp</name>
<url>http://maven.apache.org</url>
<repositories>
<repository>
<id>maven2-repository.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.8</version>
</dependency>
</dependencies>
<build>
<finalName>RESTfulExample</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
When I try to issue an mvn compile from the command line:
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Building RESTfulExample Maven Webapp
[INFO] task-segment: [compile]
[INFO] ------------------------------------------------------------------------
[INFO] [resources:resources {execution: default-resources}]
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Error building POM (may not be this project's POM).
Project ID: null:jersey-server:bundle:null
Reason: Cannot find parent: com.sun.jersey:jersey-project for project: null:jersey -server:bundle:null for project null:jersey-server:bundle:null
[INFO] ------------------------------------------------------------------------
[INFO] For more information, run Maven with the -e switch
[INFO] ------------------------------------------------------------------------
[INFO] Total time: < 1 second
[INFO] Finished at: Thu Nov 15 17:07:16 PST 2012
[INFO] Final Memory: 8M/309M
[INFO] ------------------------------------------------------------------------
Has anyone encountered this issue? I don't understand how it works on my OS X computer but not on Linux (which I don't think is the issue).
Thank you for taking the time to read this.
Upvotes: 2
Views: 4207
Reputation: 7952
I would completely remove the entire repositories
element in your pom.xml file. This way maven will use the standard central repository. Then change the version of jersey-server to 1.15 (the latest).
The latest jersey in that java.net repository is dated august 2011, while the standard central maven repository has version 1.15 dated October 30 2012.
I suspect that the reason it works on one machine and not the other is that in your ~/.m2/repository cache you have good cached files on one machine but not on the other. It may be necessary to delete the entire ~/.m2/repository/com/sun/jersey hierarchy and rebuild. You may have corrupted files there.
Upvotes: 4