Maven project from archetype – Interactive mode

mvn archetype:generate -Dfilter=org.apache.maven.archetypes:mvn archetype:generate -Dfilter=org.apache.maven.archetypes: Good ones for starting: maven-archetype-quickstart, maven-archetype-webapp mvn archetype:generate -DarchetypeCatalog=http://repo.maven.apache.org/maven2/archetype-catalog.xml -Dfilter=org.codehaus.mojo.archetypes:mvn archetype:generate -DarchetypeCatalog=http://repo.maven.apache.org/maven2/archetype-catalog.xml -Dfilter=org.codehaus.mojo.archetypes: Good ones for starting: ejb-javaee6, ejb-javaee7

jetty-maven-plugin 8.1.15.v20140411

Below a sample config for new version of jetty plugin for maven. <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>8.1.15.v20140411</version> <configuration> <webApp> <contextPath>/myapp</contextPath> </webApp> <reload>automatic</reload> <scanIntervalSeconds>1</scanIntervalSeconds> <connectors> <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector"> <port>8081</port> <maxIdleTime>60000</maxIdleTime> </connector> </connectors> </configuration> </plugin><plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>8.1.15.v20140411</version> <configuration> <webApp> <contextPath>/myapp</contextPath> </webApp> <reload>automatic</reload> <scanIntervalSeconds>1</scanIntervalSeconds> <connectors> <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector"> <port>8081</port> <maxIdleTime>60000</maxIdleTime> </connector> </connectors> </configuration> </plugin>

Install JAR in local repo

Example of installing JACOB library in local repository repo: mvn install:install-file -Dfile=jacob.jar \ -DgroupId=com.jacob \ -DartifactId=jacob \ -Dversion=1.7 \ -Dpackaging=jar \ -DlocalRepositoryPath=repo \ -DcreateChecksum=truemvn install:install-file -Dfile=jacob.jar \ -DgroupId=com.jacob \ -DartifactId=jacob \ -Dversion=1.7 \ -Dpackaging=jar \ -DlocalRepositoryPath=repo \ -DcreateChecksum=true one line version: mvn install:install-file -Dfile=jacob.jar -DgroupId=com.jacob -DartifactId=jacob -Dversion=1.7 -Dpackaging=jar -DlocalRepositoryPath=repo -DcreateChecksum=truemvn install:install-file -Dfile=jacob.jar -DgroupId=com.jacob -DartifactId=jacob -Dversion=1.7 Read more about Install JAR in local repo[…]

m2e + indigo

I’ve been suprised that in Eclipse Marketplace is no m2e plugin that works with Indigo right now. I saw… only juno or newer plugins. I found that this plugin version works good for me: http://download.eclipse.org/technology/m2e/releases/1.1/1.1.0.20120530-0009 (update site)

maven shade plugin: Executable jar with dependencies and excludes

<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>1.7.1</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <artifactSet> <excludes> <exclude>junit:junit</exclude> </excludes> </artifactSet> <transformers> <transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> <mainClass>com.test.MainClass</mainClass> </transformer> </transformers> <filters> <filter> <artifact>*:*</artifact> <excludes> <exclude>com/idontwant/that/class**</exclude> </excludes> </filter> </filters> </configuration> </execution> </executions> </plugin> </plugins> </build><build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-shade-plugin</artifactId> <version>1.7.1</version> <executions> <execution> <phase>package</phase> <goals> <goal>shade</goal> </goals> <configuration> <artifactSet> <excludes> <exclude>junit:junit</exclude> </excludes> </artifactSet> Read more about maven shade plugin: Executable jar with dependencies and excludes[…]