I have 2 projects: MyApp
and MyUtis
.
I want to add MyUtils
as a dependency to MyApp
. It almost works. I can build MyAppl
with a dependency on MyUtils
and a create jar file. It is OK from the command line.
But I have a problem with eclipse. I have a compiled MyUtils
jar file is in my local maven repository but MyApp
project in eclipse do not see MyUtils
when I don't have MyUtils
in the same workspace and in eclipse.
When I add MyUtils
project into my eclipse workspace, the project must be opened in eclipse, I can see MyUtils
classes from MyAppl
.
Can you help me? Is it possible add a dependency onto MyAppl
without adding MyUtils
project into same workspace?
In MyAppl
project I do not see jar file of MyUtils
in "Referenced Libraries" in eclipse.
Thanks.
Without a maven plugin, Eclipse does not know where to find your libraries. I would recommend installing m2e. Eclipse 4.2 Java (not Java EE) has it already installed. Then, eclipse is able to resolve your .jar dependency.
Note that you have to install the MyUtils.jar so that the jar is available in your local repository or you have to deploy it in a repository like Nexus or Artifactory.
(You could also just add the jar to the build path, but then you would have to manage two dependencies, one within the pom.xml and one in your Eclipse project.)