• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Maven build dependencies from .classpath

 
C H Kiran
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. Can maven create dependencies in pom.xml, taking input as (looking at) the .classpath in eclipse entries of a java project

2. Because, I've a no compile error project in eclipse that depends on another project SharedLibrariesProject (having all jars for a poc, shared by both client and server).
In eclipse i can clean, build all, no issues.
Problem is when I run eclipse's Maven plugin > clean (build success) then when I try Maven plugin> install, I get compile errors. Obviously, I miss all the shared folder's jars that breaks the build.

3. What i'm expecting: when i run maven>build (after clean) in my eclipse > run> i should get a jar (or .esb file archive)

I've used maven for a while (on/off, not consistently used), don't know much about maven, I wish I get simple tutorial what/how part of maven? i get too many too, custom options.. so often i get lost when try to learn maven.

thanks,
Kiran.
 
Tim Holloway
Saloon Keeper
Pie
Posts: 17646
39
Android Eclipse IDE Linux
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not a straightforward task.

Maven does not work using path-style dependencies, which are what classpaths literally are. Maven's dependencies are all based on a discrete Maven ID (artifactId, groupId and version) which is not directly deducible from the name of the dependency jar or the classpath. In fact, periodically some project or other will make an annoying change about where in the Maven namespace they want to be found and I have to go on a "treasure hunt" to fix things.

The location of Maven dependencies is also very different. In a non-Maven project, the dependency jars are located in one or more designated areas of the project and/or in external directories of unpredictable location (or at least unpredictable if you don't know the classpath, including any ECLIPSE variable substitutions). Maven dependency jars, however, are not kept on a per-project basis, they're fetched on-demand from the Maven cache when building a target and do not otherwise exist in the project.
 
Peter Johnson
author
Bartender
Posts: 5852
7
Android Eclipse IDE Ubuntu
  • 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) A tool that I find handy for identifying dependencies is JBoss Tattletale. I typically place all my JARs, including my JAR, into a single directory and point Tattletale at it and get a nice report of who depends on what. This is especially ideal when converting builds to Maven.

2) When using Maven, do not let Eclipse projects depend on each other. If project A depends on project B, then you should ste things up such that project B is always built using "mvn install", and the pom..xml; should depend on the artifact (JAR) generated by project B. Thus you should always gets dependent JAR files out of the repository. I have a number of projects that work this way and I have never had an issue. (I also helps if your Maven projects also build source and javadoc JARs and upload them to the repository, and you configure m2eclipse to also download javadoc and sources if available).

Have you looked at Better Builds with Maven and Maven: The Definitive Reference
 
C H Kiran
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Both of you.. I'll try it later.. now, I"ve another task chasing to do a poc on JBossESB.. Thanks for your time again.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic