aspose file tools*
The moose likes Ant, Maven and Other Build Tools and the fly likes Maven generation of eclipse project artifacts ..... .classpath & .project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Ant, Maven and Other Build Tools
Bookmark "Maven generation of eclipse project artifacts ..... .classpath & .project" Watch "Maven generation of eclipse project artifacts ..... .classpath & .project" New topic
Author

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

Jeevan Sunkersett
Ranch Hand

Joined: Jul 03, 2007
Posts: 77
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

Joined: Jun 24, 2003
Posts: 3274
    
    5

Unfortunately as far as I'm aware you can only add them manually.


Cheers, Martijn - Blog,
Twitter, PCGen, Ikasan, My The Well-Grounded Java Developer book!,
My start-up.
Uli Hofstoetter
Ranch Hand

Joined: Nov 24, 2006
Posts: 57
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


SCEA5, Certified ScrumMaster
Martijn Verburg
author
Bartender

Joined: Jun 24, 2003
Posts: 3274
    
    5

Oh wow, does that work? Totally cool <scurries away to go and try it>!
Jeevan Sunkersett
Ranch Hand

Joined: Jul 03, 2007
Posts: 77
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

Joined: Nov 24, 2006
Posts: 57
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

Joined: Jun 24, 2003
Posts: 3274
    
    5

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
 
subject: Maven generation of eclipse project artifacts ..... .classpath & .project