Jetty
  1. Jetty
  2. JETTY-440

maven-jetty-jspc-plugin doesn't take to account servlet-mapping

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 6.1.6
    • Fix Version/s: None
    • Component/s: Maven
    • Labels:
      None
    • Number of attachments :
      2

      Description

      I want to precompile my JSP's which have *.html extensions (historically).

      For everything to work when no precompilation used I added the followign servlet mappign to my web.xml

      <!-- [INSERT FRAGMENT HERE] -->

      <servlet-mapping>
      <servlet-name>jsp</servlet-name>
      <url-pattern>*.html</url-pattern>
      </servlet-mapping>

      but when running maven-jetty-jspc-plugin it doesn't take to the account this mapping, but only *.jsp files are processed.
      I find no other configuration I could modify in doc:
      http://jetty.mortbay.org/jspc-maven-plugin/jspc-mojo.html

        Activity

        Hide
        Oleksandr Maksymchuk added a comment -

        To make it even more flexible from maven side I've added the following configuration parameters to the plugin (see patch):

        extensions = "jsp,jspx"

        • Comma delimited JSPs file extensions.
        • By default jsp and jspx filex are processed only.
        • If you want to process html files or some other custom extension, set it here.
        • Only one extension can be set for now.

        includes

        • The comma separated list of tokens to include in the bundle.
        • By default will include all extensions.

        excludes

        • The comma separated list of tokens to exclude from the bundle.

        I've added by default */.svn/,/Jetty_* to the default excludes (just to exclude Jetty work files and svn repository files) althogh all
        DirectoryScanner.DEFAULTEXCLUDES can be used easily joining them.

        This patch also fixes bug that generated sources were not actually removed due that packageRootDirectory were not added to generatedClasses, here is the fix:
        //delete the .java files - depending on keepGenerated setting
        if (!keepSources)
        {
        String packageRootDirectory = packageRoot.replace('.', File.separatorChar);

        File generatedClassesDir = new File(generatedClasses + File.separatorChar + packageRootDirectory);

        Please apply this patch.

        Show
        Oleksandr Maksymchuk added a comment - To make it even more flexible from maven side I've added the following configuration parameters to the plugin (see patch): extensions = "jsp,jspx" Comma delimited JSPs file extensions. By default jsp and jspx filex are processed only. If you want to process html files or some other custom extension, set it here. Only one extension can be set for now. includes The comma separated list of tokens to include in the bundle. By default will include all extensions. excludes The comma separated list of tokens to exclude from the bundle. I've added by default * /.svn/, /Jetty_ * to the default excludes (just to exclude Jetty work files and svn repository files) althogh all DirectoryScanner.DEFAULTEXCLUDES can be used easily joining them. This patch also fixes bug that generated sources were not actually removed due that packageRootDirectory were not added to generatedClasses, here is the fix: //delete the .java files - depending on keepGenerated setting if (!keepSources) { String packageRootDirectory = packageRoot.replace('.', File.separatorChar); File generatedClassesDir = new File(generatedClasses + File.separatorChar + packageRootDirectory); Please apply this patch.
        Hide
        Ron Lussier added a comment -

        Is there any possibility of this patch making it into a release of the JSPC plugin?

        Show
        Ron Lussier added a comment - Is there any possibility of this patch making it into a release of the JSPC plugin?
        Hide
        Oleksandr Maksymchuk added a comment -

        If you just want to use it install attached jar into your repository and wait until it will be updated.
        It took so long already. I'm using this version with successfully with updates to the server dependencies (runng 6.1.9).

        Here is an example of maven2 plugin configuration:

        <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>maven-jetty-jspc-plugin</artifactId>
        <!-- Patched version of plugin -->
        <version>6.1.5</version>

        <executions>
        <execution>
        <id>jspc</id>

        <goals>
        <goal>jspc</goal>
        </goals>
        </execution>
        </executions>

        <configuration>
        <packageRoot>com.company.project.webapp.jsp</packageRoot>
        <extensions>html,jsp</extensions>
        <!-- Excluding dojo as it could have html files wich don't need to be compiled. -->
        <excludes>includes/, META-INF/, WEB-INF/classes/, js/</excludes>
        <verbose>true</verbose>
        </configuration>
        </plugin>

        Show
        Oleksandr Maksymchuk added a comment - If you just want to use it install attached jar into your repository and wait until it will be updated. It took so long already. I'm using this version with successfully with updates to the server dependencies (runng 6.1.9). Here is an example of maven2 plugin configuration: <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>maven-jetty-jspc-plugin</artifactId> <!-- Patched version of plugin --> <version>6.1.5</version> <executions> <execution> <id>jspc</id> <goals> <goal>jspc</goal> </goals> </execution> </executions> <configuration> <packageRoot>com.company.project.webapp.jsp</packageRoot> <extensions>html,jsp</extensions> <!-- Excluding dojo as it could have html files wich don't need to be compiled. --> <excludes>includes/, META-INF/, WEB-INF/classes/, js/</excludes> <verbose>true</verbose> </configuration> </plugin>
        Hide
        Jan Bartel added a comment -

        Wow, Oleksandr I'm so sorry I somehow didn't see this patch before!!!

        I've applied it to trunk, with a modification. I decided to just use <includes> and <excludes> patterns rather than specify the <extensions> separately, so now it would be:

        <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>jetty-maven-jspc-plugin</artifactId>
        <executions>
        <execution>
        <id>jspc</id>
        <goals>
        <goal>jspc</goal>
        </goals>
        </execution>
        </executions>
        <configuration>
        <packageRoot>com.company.project.webapp.jsp</packageRoot>
        <includes>*/.jsp, */.jspx</includes>
        <excludes>*/.foo</excludes>
        <verbose>true</verbose>
        </configuration>
        </plugin>

        I've applied this change to svn trunk (revision 2819) and I'll also put it on the 6.1 branch too and post again with that revision number. Both patches should be in time for 7.0pre1 and 6.1.10 respectively.

        Show
        Jan Bartel added a comment - Wow, Oleksandr I'm so sorry I somehow didn't see this patch before!!! I've applied it to trunk, with a modification. I decided to just use <includes> and <excludes> patterns rather than specify the <extensions> separately, so now it would be: <plugin> <groupId>org.mortbay.jetty</groupId> <artifactId>jetty-maven-jspc-plugin</artifactId> <executions> <execution> <id>jspc</id> <goals> <goal>jspc</goal> </goals> </execution> </executions> <configuration> <packageRoot>com.company.project.webapp.jsp</packageRoot> <includes>* / .jsp, * / .jspx</includes> <excludes>* / .foo</excludes> <verbose>true</verbose> </configuration> </plugin> I've applied this change to svn trunk (revision 2819) and I'll also put it on the 6.1 branch too and post again with that revision number. Both patches should be in time for 7.0pre1 and 6.1.10 respectively.
        Hide
        Jan Bartel added a comment -

        OK, committed the changes also to the 6.1 branch as revision 2820.

        Jan

        Show
        Jan Bartel added a comment - OK, committed the changes also to the 6.1 branch as revision 2820. Jan
        Hide
        Oleksandr Maksymchuk added a comment -

        In VERSIONS.txt I see JETTY-440 is listed only under jetty-7.0-SNAPSHOT nothing in under 6.1.
        I should probably wait till some 7.0 release to test/use it then.

        Show
        Oleksandr Maksymchuk added a comment - In VERSIONS.txt I see JETTY-440 is listed only under jetty-7.0-SNAPSHOT nothing in under 6.1. I should probably wait till some 7.0 release to test/use it then.
        Hide
        Jan Bartel added a comment -

        Oleksandr, it is checked into the jetty-6.1 branch, so you have to look at that branch's VERSIONS.txt file.

        cheers
        Jan

        Show
        Jan Bartel added a comment - Oleksandr, it is checked into the jetty-6.1 branch, so you have to look at that branch's VERSIONS.txt file. cheers Jan

          People

          • Assignee:
            Jan Bartel
            Reporter:
            Oleksandr Maksymchuk
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: