This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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.
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.
An IDE is no substitute for an Intelligent Developer.
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).