Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using maven to connect to a local project

Tags:

java

maven

I have two projects in eclipse:

  1. framework: A general library used in several projects.
  2. client: A project that uses framework.

client is quite large, possibly larger than framework at this point. I am using client as sort of a test fixture for framework. I want to make a few changes in framework and test them in client. Currently, I have to do a full build of framework, install it into a maven repo, and then rebuild client.

Is there a way to just have client point to framework directly on my local disk? Any other hints for developing in such a situation (ie is the a better way)?

like image 555
User1 Avatar asked Jun 30 '11 14:06

User1


People also ask

How do I add Maven to an existing project?

Add Maven support Open an existing project, for example, a Java project. In the Project tool window, right-click your project and select Add Framework Support. In the dialog that opens, select Maven from the options on the left and click OK.


2 Answers

You can specify dependencies from the local disk using <systemPath> like so:

<dependency>
    <groupId>example.logging</groupId>
     <artifactId>commons-logging</artifactId>
     <version>1.0.0</version>
     <scope>system</scope>
     <systemPath>${project.basedir}/lib/commons-logging.jar</systemPath>
</dependency>

I'm not sure if you can point to a directory that has a pom in it, but at least you don't have to deploy it into maven.

like image 95
marchaos Avatar answered Sep 20 '22 13:09

marchaos


Running mvn install on Framework will build it and install it in your local Maven repository (that is, the Maven repository on your local disk). When you run your tests in Client, Maven will automatically use the version of Framework in your local repository.

like image 41
Daniel Avatar answered Sep 18 '22 13:09

Daniel