0

I've just started to experiment with the I-Jetty server which runs on an Android platform. To start with, I tried to create a simple web app using the Maven archetype "maven-archetype-webapp" from org.apache.maven.archetypes, which I wanted to test on I-Jetty. This results in a minimal maven project, with a simple jsp file called index.jsp, which looks like this.

<html>
<body>
<h2>Hello!</h2>
</body>
</html>

When exporting this webapp as a war, and deploying to I-Jetty, I get the "jsp not supported" from I-Jetty. Doing some research, I found out that I had to precompile the JSP since I-Jetty doesn't have a JSP compiler. And this is where the problem is. I am trying to use the precompiling plugin called jetty-jspc-maven-plugin. I am using Eclipse Kepler, with the m2e plugin.

I have searched for different ways to approach precompiling jsps, and have this pom as a result;

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>eggum</groupId>
<artifactId>odin</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>odin Maven Webapp</name>
<url>http://maven.apache.org</url>
<dependencies>
    <dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>3.8.1</version>
    <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>
</dependencies>
<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>  
<build>
    <finalName>odin</finalName>    
    <pluginManagement>        
    <plugins>
        <plugin>
            <groupId>org.mortbay.jetty</groupId>
            <artifactId>jetty-jspc-maven-plugin</artifactId>
    <!--    <version>7.3.0.v20110203</version>   -->
            <version>9.1.0.M0</version>
            <extensions>true</extensions>
            <executions>
                <execution>
                    <id>jspc</id>
                    <goals>
                        <goal>jspc</goal>
                    </goals>
                    <configuration>
                        <includes>**/*.jsp</includes>
                        <webAppSourceDirectory>${basedir}/src/main/webapp</webAppSourceDirectory>  
                        <verbose>true</verbose>
                        <keepSources>true</keepSources>
                        <generatedClasses>${project.build.outputDirectory}/abc</generatedClasses>
                    </configuration>
                </execution>                
            </executions>
        </plugin>       
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.3</version>
            <configuration>
                <webXml>${basedir}/target/odin/WEB-INF/web.xml</webXml>
            </configuration>
        </plugin>
    </plugins>    
    </pluginManagement>
</build>
</project>

When running the project as maven install, the project is successfully built, but it seems like my jetty-jspc-maven-plugin is totally ignored in the build:

SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building odin Maven Webapp 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) @ odin ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ odin ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) @ odin ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\EclipseKepler\odin\src\test\resources
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ odin ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.10:test (default-test) @ odin ---
[INFO] Surefire report directory: D:\EclipseKepler\odin\target\surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0

[INFO] 
[INFO] --- maven-war-plugin:2.3:war (default-war) @ odin ---
[INFO] Packaging webapp
[INFO] Assembling webapp [odin] in [D:\EclipseKepler\odin\target\odin]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\EclipseKepler\odin\src\main\webapp]
[INFO] Webapp assembled in [23 msecs]
[INFO] Building war: D:\EclipseKepler\odin\target\odin.war
[INFO] 
[INFO] --- maven-install-plugin:2.3.1:install (default-install) @ odin ---
[INFO] Installing D:\EclipseKepler\odin\target\odin.war to                     C:\Users\Dag\.m2\repository\eggum\odin\0.0.1-SNAPSHOT\odin-0.0.1-SNAPSHOT.war
[INFO] Installing D:\EclipseKepler\odin\pom.xml to C:\Users\Dag\.m2\repository\eggum\odin\0.0.1-    
SNAPSHOT\odin-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.581s
[INFO] Finished at: Mon Oct 14 11:34:27 CEST 2013
[INFO] Final Memory: 8M/155M
[INFO] ------------------------------------------------------------------------

I would expect a something looking like this in the process

[INFO] --- jetty-jspc-maven-plugin (jspc-compile) @ odin ---
[INFO] Compiling one jsp file...

but I don't even get a fault code or anything after including the jspc plugin. Being pretty new to maven, I seek some help regarding this ignorement of the jetty-jspc-maven-plugin from an experienced maven user. Is it a build-cycle problem? Is Eclipse, or m2e, silently ignoring this plugin for some reason? As you can see the maven-war-plugin is executed, so it seem like not all plugins are ignored.

This is my first question posted on Stackoverflow ever, so please forgive me if i am missing any info regarding this post.

1 Answers1

0

I found out what the issue was. It was indeed a lifecycle problem, which I hid from myself by adding the tags around my code. I found the solution partly using this post;

Why am I receiving a "Plugin execution not covered by lifecycle configuration with GWT" error?

Community
  • 1
  • 1