Example of importing into your local Maven repository

You cannot get to some *.jar files remotely and you still need to build your project, you can use these commands to import into your local repository.

Example:

call mvn install:install-file -Dfile=/c/jars/ehcache-2.7.2.jar -DgroupId=net.sf.ehcache -DartifactId=ehcache -Dversion=2.7.2 -Dpackaging=jar

copy C:\jars\ehcache-2.7.2.jar C:\Users\userid\.m2\repository\net\sf\ehcache\ehcache\2.7.2\ehcache-2.7.2.jar.sha1

Refer: sample-maven-local-import.txt

Getting the wrong jar out of Maven repository

From: Guillaume Radde [mailto:guillaume.radde@redhat.com]
Sent: Saturday, September 29, 2012 5:24 PM
To: Ruckman, Maurice (HAL)
Subject: Re: Nexus and Maven

If for some reason (and it rarely happens), you think you have a wrong jar in your local repository, you can rename the repository folder and maven will think it doesn't have a local repo and re-download everything:

$ mv /home/maurice/.m2/repository /home/maurice/.m2/disabled-repository
$ mvn install
-> maven will recreate the /home/maurice/.m2/repository folder with fresh content it will have to redownload
If you believe the shared Nexus repository contains an eronous jar, you can disable it in your settings.xml (see /home/maurice/.m2/settings.xml). You will have to fight with the proxy if you disable the shared Nexus repo on your VM as maven will try to connect directly to the internet.

Hope all is well

G

Modular Applications Development with Maven

Notes:

Different ways to run Maven:
http://www.vineetmanohar.com/2009/11/3-ways-to-run-java-main-from-maven/

/home/jboss1./m2/repository

<version>1.0</version> is for application, and SNAPSHOT for development

These three tags are mandatory:

<groupId>com.hollandamerica</groupId>
<artifactId>ModularApplicationTutorial</artifactId>
<version>1.0</version>

1) Create a pom.xml to compile the application into a jar called cruiser.jar. Run the test suite.

2) You want to move the development of the booking service to a separate project. Create a separate pom.xml to compile Booking.java, BookingService.java and BookingServiceImpl.java into a separate jar called booking.jar. Have cruiser.jar use booking.jar. Execute cruiser.jar to verify it works correctly.

3) You want cruiser.jar and booking.jar to always have the same version number. Create a parent pom.xml for your 2 projects called booking-parent, and define a property called VERSION. Have booking.jar and cruiser.jar make use of this VERSION property as their version number.

4) You want to compile both cruiser.jar and booking.jar in one single command. Have cruiser.jar and booking.jar be two submodules of booking-parent.

5) Split booking.jar into booking-api.jar (containing the interface) and booking-impl.jar (containing the implementation of the service). Execute cruiser.jar to verify it still works correctly.

6) We want to prevent developers of cruiser.jar to make direct calls to a specific booking-api implementation. Propose a way to remove the direct dependency between cruiser.jar and booking-impl.jar. Implement it.