5

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?

user1099501
  • 55
  • 1
  • 6

1 Answers1

6

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.

miq
  • 2,746
  • 2
  • 24
  • 35
  • Thanks, I had to disable the workspace resolution. The maven-dependency-plugin error went away when I unchecked "Resolve Workspace artifacts" under Run Configurations. – user1099501 Dec 16 '11 at 10:06