Search
Calendar
April 2017
S M T W T F S
« Sep    
 1
2345678
9101112131415
16171819202122
23242526272829
30  
Your widget title
Archives

Posts Tagged ‘Maven 2’

PostHeaderIcon (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.

PostHeaderIcon 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-plugin)

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>

PostHeaderIcon 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-plugin)

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">

PostHeaderIcon 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-plugin)

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>

PostHeaderIcon 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>
(...)