Posts Tagged ‘Maven 2’
(long tweet) Increase choice with mvn archetype:generate
By default, mvn archetype:generate offers
~50 template projects. How to offer more templates?
Actually, Maven bases itself on a archetype-catalog.xml
file, in Maven’s local repository. Updating this file is possible, by mvn archetype:crawl
(and/or archetype:update-local-catalog
?).
Anyway, Maven can base on a remote repository, using archetypeCatalog
, such as:
mvn archetype:generate -DarchetypeCatalog=http://download.java.net/maven/2
You can hint at the remote repository available in settings.xml
file, for instance.
Maven / Jetty 7 / java.lang.NoClassDefFoundError: javax/servlet/ServletRequestListener
Case
My project is deployed via Maven on a Jetty 6 server. I have to upgrade the server to Jetty 7.
(BTW: notice that the plugin maven-jetty-plugin
was renamed as jetty-maven-plugi
n)
I get this error:
java.lang.NoClassDefFoundError: javax/servlet/ServletRequestListener
Quick Fix
In Jetty plugin, add a dependency to servlet-api, eg:
<plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-plugin</artifactId> <version>7.4.4.v20110707</version> <dependencies> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.4</version> </dependency> </dependencies>
Maven / Jetty / Cause: Class name which was explicitly given in configuration using ‘implementation’ attribute: ‘org.mortbay.jetty.bio.SocketConnector’ cannot be loaded
Case
My project is deployed via Maven on a Jetty 6 server. I have to upgrade the server to Jetty 7.
(BTW: notice that the plugin maven-jetty-plugin
was renamed as jetty-maven-plugi
n)
I get this error:
Cause: Class name which was explicitly given in configuration using 'implementation' attribute: 'org.mortbay.jetty.bio.SocketConnector' cannot be loaded
Quick fix
org.mortbay.jetty.bio.SocketConnector
was removed from Jetty with the release 7. To fix the issue, use a more recent implementation. For instance, replace this block:
<connector implementation="org.mortbay.jetty.bio.SocketConnector">
with that one:
<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
Maven / Jetty / Cannot override read-only parameter: contextPath in goal
Case
My project is deployed via Maven on a Jetty 6 server. I have to upgrade the server to Jetty 7.
(BTW: notice that the plugin maven-jetty-plugin
was renamed as jetty-maven-plugi
n)
I get this error:
Error configuring: org.mortbay.jetty:jetty-maven-plugin. Reason: ERROR: Cannot override read-only parameter: contextPath in goal: jetty:run-exploded
Quick fix
Insert a tag <webAppConfig>
between <configuration>
and <contextPath>
. In other terms, replace this block:
<configuration> <contextPath>/I/love/USA</contextPath> </configuration>
with that one:
<configuration> <webAppConfig> <contextPath>/I/love/USA</contextPath> </webAppConfig> </configuration>
Maven / Jetty / java.lang.ClassNotFoundException: org.apache.axis2.transport.http.AxisAdminServlet
Case
I have a WAR containing Axis2-built on webservices. I must deploy it under Jetty 6. The version of Axis2 is 1.5.X.
I get this exception:
java.lang.ClassNotFoundException: org.apache.axis2.transport.http.AxisAdminServlet
I assume the same case may occur with Tomcat.
Explanation
The class AxisAdminServlet
was removed from Axis2 between the releases 1.4 and 1.5.
Quick fix
Add the following dependency in Maven’s Jetty plugin:
<plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-plugin</artifactId> <version>6.1.26</version> <dependencies> <dependency> <groupId>org.apache.axis2</groupId> <artifactId>axis2-kernel</artifactId> <version>1.4.1</version> </dependency> </dependencies> (...)