Loading...
 

Maven FAQ

How can I upload a multi module maven project with eclipse to a CVS repostiory?

  • Commit the parent project the usual way
  • Commit the child projects and set 'Use specified module name:' to '/' (e.g 'cocoNG/core', 'cocoNG/web')
  • Do no 2 for all your child projects
  • To get the multi module project from cvs you have to get just the parent project. Create new project from CVS and select only the parent project.
  • Remove the project from your workspace WITHOUT deleting the files!!!
  • In eclipse do 'File/Import/Maven project'
  • Select the parent directory and select all available projects
  • You have now projects for the parent and every child in your workspace

How to call maven command without testing?

Call maven with additional '-Dmaven.test.skip' parameter. E.g. mvn -Dmaven.test.skip install

How can I add a global repository to maven?

This you have to do in the $M2_HOME/settings.xml file. To add e.g. the embase repository, add:

<repositories>
   <repository>
      <id>central</id>
      <url>http://embase/maven/repository</url>
      <snapshots>
         <enabled>true</enabled>
         <checksumPolicy>warn</checksumPolicy>
      </snapshots>
   </repository>
<repository>
   <id>snapshots</id>
      <url>http://embase/maven/deploy</url>
      <releases>
         <enabled>true</enabled>
         <checksumPolicy>warn</checksumPolicy>
      </releases>
</repository>
...
<pluginRepositories>
   <pluginRepository>
      <id>central</id>
      <url>http://embase/maven/repository</url>
      <snapshots>
         <enabled>false</enabled>
         <checksumPolicy>warn</checksumPolicy>
      </snapshots>
   </pluginRepository>
   <pluginRepository>
      <id>snapshots</id>
      <url>http://embase/maven/repository</url>
      <releases>
         <enabled>false</enabled>
         <checksumPolicy>warn</checksumPolicy>
      </releases>
   </pluginRepository>
...

How to create JSP pages and Controllers automatically in Appfuse?

Use: mvn appfuse:gen -Dentity= The entity is the name of an already created model in Appfuse. E.g. 'Person' This command creates basic JSP pages and a controller, the VC part of MVC so to speak. But it uses the Generic DAO and manager of Appfuse.

How to install a third-party jar in maven repository when it is not available from know repository

You can always use the following command (go in your .m2 dir for this); for example I needed the Picard/Sam jars (download the jar file(s) first somewhere):

cd ~/.m2 
mvn install:install-file -DgroupId=net.sf -DartifactId=sam -Dversion=1.92 -Dfile=/path/to/sam-1.92.jar -Dpackaging=jar -DgeneratePom=true 
mvn install:install-file -DgroupId=net.sf -DartifactId=picard -Dversion=1.92 -Dfile=/path/to/picard-1.92.jar -Dpackaging=jar -DgeneratePom=true

Note we have a embl maven repository for centralizing this so that all developers working on the same project would then get the jar automatically upon project update. First, you should tell your local maven about it i.e. add this in your ~/.m2/setting.xml:

1. Add this repository definition

<repository>

<id>snapshots</id>

<url>http://embase/maven/deploy</url>

<releases>

<enabled>true</enabled>

<checksumPolicy>warn</checksumPolicy>

</releases> </repository>

 2. Add this plugin repository definition

<pluginRepository>

<id>snapshots</id>

<url>http://embase/maven/repository</url>

<releases>

<enabled>false</enabled>

<checksumPolicy>warn</checksumPolicy>

</releases>

</pluginRepository>

3. Then add the jars directly as base user (ask gbcs at embl.de if you can't) in /home/base/.m2 (log on base3 server)