[jetty-dev] [jira] (JETTY-1486) Dependency jar files are no longer scanned for .tld files with jetty-maven-plugin

"Leonardo Uribe (JIRA)" <[email protected]>
Newsgroups gmane.comp.java.jetty.general
Message-ID <1529203970.44444.1330455497641.JavaMail.j2ee-jira@codehaus01.managed.contegix.com>
    [ https://jira.codehaus.org/browse/JETTY-1486?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=292940#comment-292940 ] 

Leonardo Uribe commented on JETTY-1486:
---------------------------------------

Hi

I tried this with jetty 7.6.1.v20120215 as described in the wiki:

        <profile>
            <!-- Plugin embedded jetty 7 container. 
                 Just running use:
                  mvn clean -Dcontainer=jetty7 jetty:run 
            -->
            <!-- For debugging use (attach debugger port 8000):
                 mvnDebug clean -Dcontainer=jetty7 jetty:run 
            -->
            <id>jetty7Config</id>
            <activation>
                <property>
                    <name>container</name>
                    <value>jetty7</value>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <!--This plugin allows to run the war using mvn jetty:run -->
                        <groupId>org.mortbay.jetty</groupId>
                        <artifactId>jetty-maven-plugin</artifactId>
                        <version>7.6.1.v20120215</version>
                        <configuration>
                            <systemProperties>
                                <systemProperty>
                                    <!-- use the ecj compiler -->
                                    <name>org.apache.jasper.compiler.disablejsr199</name>
                                    <value>true</value>
                                </systemProperty>
                            </systemProperties>
                            <contextXml>${basedir}/src/conf/jetty/context.xml</contextXml>
                            <webApp>
                                <contextPath>/${artifactId}</contextPath>
                            </webApp>
                            <scanIntervalSeconds>5</scanIntervalSeconds>
                        </configuration>
                        <dependencies>
                           <!-- Tld scanning only works when JSF is included
                                as container dependency. -->
                            <dependency>
                                <groupId>org.apache.myfaces.core</groupId>
                                <artifactId>myfaces-api</artifactId>
                                <version>${jsf-myfaces.version}</version>
                                <scope>compile</scope>
                            </dependency>
                            <dependency>
                                <groupId>org.apache.myfaces.core</groupId>
                                <artifactId>myfaces-impl</artifactId>
                                <version>${jsf-myfaces.version}</version>
                                <scope>runtime</scope>
                            </dependency>
                            <dependency>
                               <groupId>javax.el</groupId>
                               <artifactId>javax.el-api</artifactId>
                               <version>2.2.1</version>
                               <scope>provided</scope>
                           </dependency>
                           <dependency>
                               <groupId>org.glassfish.web</groupId>
                               <artifactId>javax.el</artifactId>
                               <version>2.2.1</version>
                               <scope>provided</scope>
                           </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>

src/conf/jetty/context.xml

<Configure class="org.eclipse.jetty.webapp.WebAppContext">
 
    <Call name="setAttribute">
      <Arg>org.eclipse.jetty.server.webapp.ContainerIncludeJarPattern</Arg>
      <Arg>.*/.*myfaces-impl-[^/]*\.jar$|.*/.*jsp-api-[^/]*\.jar$|.*/.*jsp-[^/]*\.jar$|.*/.*taglibs[^/]*\.jar$</Arg>
    </Call>
 
</Configure>

Throws no factories configured for application (happens because the listener on myfaces tld does not load correctly). 

But I tried this using jetty 8.1.1.v20120215:

        <profile>
            <!-- Plugin embedded jetty 8 container. 
                 Just running use:
                 mvn clean jetty:run or mvn clean jetty:run 
            -->
            <!-- For debugging use (attach debugger port 8000):
                 mvnDebug clean jetty:run or mvn clean jetty:run 
            -->
            <id>jettyConfig</id>
            <activation>
                <property>
                    <name>!container</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <!--This plugin allows to run the war using mvn jetty:run -->
                        <groupId>org.mortbay.jetty</groupId>
                        <artifactId>jetty-maven-plugin</artifactId>
                        <version>${jetty.maven.plugin.version}</version>
                        <configuration>
                            <systemProperties>
                                <systemProperty>
                                    <!-- optional to use the ecj compiler -->
                                    <name>org.apache.jasper.compiler.disablejsr199</name>
                                    <value>true</value>
                                </systemProperty>
                            </systemProperties>
                            <webApp>
                                <contextPath>/${artifactId}</contextPath>
                            </webApp>
                            <scanIntervalSeconds>5</scanIntervalSeconds>
                        </configuration>
                        <dependencies>
                           <!-- Tld scanning only works when JSF is included
                                as container dependency. -->
                            <dependency>
                                <groupId>org.apache.myfaces.core</groupId>
                                <artifactId>myfaces-api</artifactId>
                                <version>${jsf-myfaces.version}</version>
                                <scope>compile</scope>
                            </dependency>
                            <dependency>
                                <groupId>org.apache.myfaces.core</groupId>
                                <artifactId>myfaces-impl</artifactId>
                                <version>${jsf-myfaces.version}</version>
                                <scope>runtime</scope>
                            </dependency>
                        </dependencies>
                    </plugin>
                </plugins>
            </build>
        </profile>

It works. 

Why it does not work with jetty-maven-plugin 7? no idea. In jetty 8 it works because MyFaces has a ServletInitializer that do what's necessary according to Servlet spec 3. Jetty 8 is enough for me. Thanks for your help. I'll keep an eye on this one if someday is fixed.
                
> Dependency jar files are no longer scanned for .tld files with jetty-maven-plugin
> ---------------------------------------------------------------------------------
>
>                 Key: JETTY-1486
>                 URL: https://jira.codehaus.org/browse/JETTY-1486
>             Project: Jetty
>          Issue Type: Bug
>          Components: Maven
>    Affects Versions: 7.5.4, 7.6.0
>            Reporter: Leonardo Uribe
>            Assignee: Jan Bartel
>         Attachments: myfaces-helloworld20.zip
>
>
> Checking some archetypes for MyFaces Core project I notice the latest version of jetty does not work.
> MyFaces has a listener entry in a .tld file, and that is not loaded or scanned anymore
> I'll attach a example webapp for this one. Just type mvn clean -PjettyConfig jetty:run. With jetty 7.4.5.v20110725 works but if you change maven.jetty.plugin.version property inside the pom to 7.6.0.v20120127 it does not, throwing a ClassNotFoundException. Later, I added myfaces jars as dependencies for the plugin but the tlds are not scanned, so myfaces listener is not loaded and another exception occur (Factory not loaded). Later if I add:
> <listener>
>   <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
> </listener>
> Into web.xml the app works, but contextPath is not added. 

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://jira.codehaus.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.