Monthly Archives: March 2013

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.

Change version for GWT application

In Eclipse are different places where you can change the version of your web application.

1. Your pom.xml
Change the version of your artifact like:

<groupId>de.uni_leipzig.smo</groupId>
<artifactId>trialregistry-gui</artifactId>
<version>0.3-SNAPSHOT</version>
<packaging>war</packaging>

2. Your build path
Set the default output folder to something similar to your pom.xml:

Build Path Settings

3. Your Run configuration
To run GWT applications you define a Run configration within Eclipse. The tab “Arguments” contains also a path to the war-directory, which could contain the version number:

Run Configration

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/

GWT Compile and wrong output dir

If your “GWT Compile” process exports the “deploy” directory to the wrong place, you can correct this within the preferences file com.google.gdt.eclipse.core.prefs, which you can find within the “.settings” directory of you Eclipse project.

eclipse.preferences.version=1
jarsExcludedFromWebInfLib=
lastWarOutDir=/path-to-your-project/src/main/webapp
warSrcDir=src/main/webapp
warSrcDirIsOutput=false

Change the “lastWarOutDir” to the correct path. It should contain the “WEB-INF” directory and GWT should create a “deploy” directory within it. Restart your IDE to load the new settings! You can check the results during “GWT Compile” with log level TRACE.