File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maven generation of eclipse project artifacts ..... .classpath & .project

 
Jeevan Sunkersett
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I use maven 2 as a build tool and eclipse as the devlopment IDE.
Using the maven goal (eclipse:eclipse) I can generate the eclipse .project & .classpath files.

I my pom.xml I have defined multiple <dependency> tags which appear in the Eclipse->"Java build path" (ie bascially the .classpath file) as
<classpathentry kind="var" path="M2_REPO/co...../>

Howver I want certain dependencies to appear as dependant projects...with the others as standard jar dependency
ie an entry in .classpath like <classpathentry kind="src" path="/MyKernel"/>
instead of <classpathentry kind="var" path="M2_REPO/co../MyKernel-1.0.0-SNAPSHOT.jar/>

Is their any way (such as an attribute/ tag in pom.xml) to specify this kind of specific generation.
Right now the only option I see is each user after the mvn eclipse:eclipse step does it manually within the eclipse IDE

~g1">
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unfortunately as far as I'm aware you can only add them manually.
 
Uli Hofstoetter
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

one way to accomplish this is to define a maven multiproject with the projects, which should have project references in eclipse, declared as modules.

Regards,
Uli
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh wow, does that work? Totally cool <scurries away to go and try it>!
 
Jeevan Sunkersett
Ranch Hand
Posts: 78
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

>> one way to accomplish this is to define a maven multiproject with the projects, which should have project references in eclipse, declared as modules.

Yes the multiproject style seems to work....in my case
I have a projects organized as ...


In the Parent POM, I have a <modules> section... defining Sub-Project-1, Sub-Project-2, ...
and a dependency-management showing the inter-dependency between projects


I observed;
If the ${project.version} is replaced by a specific value like 1.0 or 1.0.0-SNAPSHOT
the .classpath generated via the mvn eclipse:eclipse,command; differs

With <version>${project.version}</version> it (the generated .classpath) has entry like
<classpathentry kind="src" path="/sub-project-2"/> what I refer to as Project-dependancy

but with <version>1.0.0-SNAPSHOT</version> the entry is like
<classpathentry kind="var" path="M2_REPO/aaa/bbb/ccc/1.0.0-SNAPSHOT/artifact-sub-project-2-1.0.0-SNAPSHOT.jar"/> what I refer to as Jar-dependency

Is this a standard MVN behaviour or is something else causing this?

~g1
 
Uli Hofstoetter
Ranch Hand
Posts: 57
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the version defined in your parent's pom?

I noticed the following behaviour: if a module's version is the same as noted in the dependency management, a project reference in eclipse is created. If the dependency magement defines another (e.g. older) version, than the module's version in the other directory, the classpath entry points to the repository.

Regards,
Uli
 
Martijn Verburg
author
Bartender
Posts: 3275
5
Eclipse IDE Java Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I just tried it here as well and what Uli mentioned seems to be the case, get the version right and it creates the eclipse reference, else it goes to the repository. I confess I don't use the Eclipse integration/plugin normally, but this was kind of cool
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic