Blog Archives

Change Maven repository directory within Eclipse

If you use the embedded Maven installation within Eclipse, the default .m2 directory (which contains the repository) resides in the profile of the current user.

In Windows, this is the C:\Documents and Settings\<user> directory. A large repository there could result in problems with server based profiles. Is there a quota on the server, it could be not possible to save the profile back to the server, if it contains a lot of Maven artifacts.

You can set the repository directory within the settings.xml. Copy the .m2 directory into another path on your computer (outside of your profile). Edit the settings.xml and set a new path to your repository:

  <!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ~/.m2/repository -->
  <localRepository>C:/arothe/.m2/repository</localRepository>

Enter Eclipse Preferences and change the User Settings path. Click on “Update Settings” and the Local Repository should be changed to the path defined within your settings.xml. Click on “Reindex”.

Eclipse Maven Settings

Last but not least, delete the .m2 folder from your profile directory.

Use a simple shell within Eclipse

The WickedShell project provides a shell view within Eclipse to execute some scripts or programs. It is very simple to execute a Maven build within this shell instead of opening a terminal window from the Linux desktop. Very cool!

http://www.wickedshell.net/

Cayenne-Modeler with Netbeans 6.9

It is possible to start the Cayenne modeler within Netbeans. Go to your Maven project and right-click on the project name. Choose Custom->Goals… and put “cayenne-modeler:run” (without quotes) into the first line. Click on “Remember as” and choose a name for the goal (like Cayenne-Modeler). Now you have a new menu item, which can start the modeler. But you need the associated plugin within the pom-file of the project. Go to “Project Files” and open the “pom.xml”. Add

<build>
<plugins>
<plugin>
<groupId>org.apache.cayenne.plugins</groupId>
<artifactId>maven-cayenne-modeler-plugin</artifactId>
</plugin>
</plugins>
</build>

Now you can open the modeler.

Proximity

I use Proximity as Maven mirror. If you need a new repository to use the artifacts for your project, you have to change three XML files to add it, which is a not easy and every time you have to copy and paste some parts of the configuration and have to change them manually. Because I’m a lazy developer I have written a script to create the necessary XML tags. You can download it from the server. Check the path of the Proximity installation within the script, per default it is set to $CATALINA_HOME/webapps/proximity. The script contains only a basic logic, you can enhance it with more complex things. The new repository will be added to the “public” repository group, which is set as the mirror within the Maven configuration file.