3

In our company we have integrated Jenkins with SONAR. we have pom.xml file to compile java files when we build project in Jenkins. Similarily we are looking for a plugin which compiles jsp pages. I found that "jspc-maven-plugin" in combination with "maven-war-plugin" can do the job.

I have inserted this piece of code in my pom.xml but it dosent seem to give me any output:

<plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jspc-maven-plugin</artifactId>
            <version>1.4.6</version> 
            <executions>
                <execution>
                    <id>jspc</id>
                    <goals>
                        <goal>compile</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>1.6.3</version> 
            <configuration>
                <!--<webXml>${basedir}/target/jspweb.xml</webXml>-->
                <webXml>D:\BuildRepository\OOTB\XYZ\codebase\WEB-INF\web.xml</webXml>
                            </configuration>
        </plugin>

My web.xml is in the location "D:\BuildRepository\OOTB\XYZ\codebase\WEB-INF\web.xml" and my jsps are in the location "D:\abc\def\SourceCode\Build\src\main\webapp\jsp". SO how do I configure my pom.xml to compile jsps that are present in mentioned location?

galme
  • 603
  • 3
  • 10
  • 24
  • The configuration looks slightly different, so for first step try to configure plugin like the default config---> https://sling.apache.org/documentation/development/jspc.html and call the jspc goal...it works for me...Let me know :) – ivoruJavaBoy Apr 22 '14 at 09:16
  • As you suggested i tried using sling.apache.org jspc maven plugin and I am getting the below error : Caused by: "java.lang.NoClassDefFoundError: org/apache/sling/scripting/jsp/jasper/Options" How can I get rid of this error please let me know. – galme Apr 24 '14 at 10:21
  • 1
    Here you can find an explanation of the problem----> http://apache-sling.73963.n3.nabble.com/jspc-and-java-lang-NoClassDefFoundError-org-apache-sling-commons-classloader-DynamicClassLoader-td3997319.html ---> here you can see similar question where is suggested how to put dependencies directly for the plugin--->http://stackoverflow.com/questions/8797773/maven-plugin-builds-but-cant-execute-due-to-java-lang-noclassdeffounderror-org Let me now! bye – ivoruJavaBoy Apr 24 '14 at 10:38
  • You may want to look at the updated plugin here: https://github.com/Jasig/jspc-maven-plugin We have been using it successfully for some time. – Travis Schneeberger Sep 16 '16 at 22:02
  • 1
    Note that the jspc plugin referenced by @TravisSchneeberger is now unmaintained. (saved you a click) – Black Oct 02 '17 at 00:08

0 Answers0