Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Local Maven Dependency project is referenced as a class folder instead of a jar

I'm using Eclipse Indigo with the m2e Plugin (Version 1.0.1). I have two separate workspace projects: A Maven Project that is basically a Vaadin widget and a second Maven project that is my main project which is referencing that widget with:

<dependency>
   <groupId>com.mycompany.widget</groupId>
   <artifactId>Calendar</artifactId>
   <version>1.2</version>
   <type>jar</type>
</dependency>

If I run mvn clean install on the widget project it is packaged properly as a jar and also available in my local Maven repository. I can also use the classes of the widget in my main project. However, in my main project's Maven dependencies, the widget project is shown as a class folder instead of a jar (though all other external widget dependencies are shown as jar files).

This causes some problems when I try to unpack (or even copy) the dependency to my main project with dependency:unpack-dependencies (resp. dependency:copy-dependencies). The maven build fails with:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-dependency-plugin:2.4:unpack-dependencies (default-cli) on project [main project]: Error unpacking file: /.../Calendar/target/classes to: /.../[main-project]/target/classes 
[ERROR] org.codehaus.plexus.archiver.ArchiverException: The source must not be a directory.

My question is: How can I reference my widget project as a jar instead of a class folder in my main project?

like image 241
user1099501 Avatar asked Dec 15 '11 10:12

user1099501


1 Answers

They are in separate directories, right? Try this: Right-click your project, select Maven -> Disable Workspace Resolution.

Also check the project properties and make sure that the project isn't referenced in Java Build Path -> Projects.

like image 60
miq Avatar answered Oct 08 '22 21:10

miq