• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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

 
Ranch Hand
Posts: 78
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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">
 
author
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unfortunately as far as I'm aware you can only add them manually.
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 3285
13
Mac OS X Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
That new kid is a freak. Show him this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic