facebook

incorrect deployment with scope=provided

  1. MyEclipse IDE
  2.  > 
  3. Maven for MyEclipse (Maven4MyEclipse)
Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #323374 Reply

    msquared
    Member

    MyEclipse 10.0.1 does not correctly deploy specific libraries when scope=provided.
    Here is a reproducible test case:
    1) start with a clean install of MyEclipse 10.0.1 (should not matter but I use linux 64 bit)
    2) launch into a brand new workspace
    3) create a new WebProject and check Add Maven support with all other settings per default .notice that the generated pom.xml contains 3 dependencies, all scope=provided
    4) now deploy this to the integrated MyEclipseTomcat server (the same bug occurs regardless of exploded or packaged archive).
    5) browse the deployment location (workspace/.metatdata/.me_tcat/webapps/MyProject/WEB-INF/lib) and observe that jstl-1.2.jar is there. That is incorrect, as the pom shows this is scope=provided. Observe that the other 2 dependencies (javaee-api and jsp-api) are NOT there which fortunately is correct, but inconsistent.

    So there you have it. A bug with dependencies if scope=provided that is specific to only certain libraries but not others.
    Running mvn dependency:tree confirms all 3 libraries definitely have scope=provided.
    Maven of course does not deploy any libraries where scope=provided.

    Then I started playing around with different maven coordinates groupId:archiveId:versionId to see why only javax.servlet:jstl:1.2 encounters the bug.
    I observed that if I move this exact jar to a different groupId or archiveId the bug goes away (jar is NOT deployed). However if I change only the version the bug remains.

    This bug also seems to affect javax.faces:jsf-api:anyversion and javax.faces:jsf-impl:anyversion.
    Those were the only specific ones I noticed, but there may be others !

    Can you help fix this?
    I can workaround it by moving the affected jars from their standard maven coordinates to a different location such as
    <dependency>
    <groupId>javax.servlet.myeclipse-bug</groupId>
    <artifactId>jstl</artifactId>
    <version>1.2</version>
    <scope>provided</scope>
    </dependency>

    #323402 Reply

    support-swapna
    Moderator

    msquared ,

    Thank you for the detailed steps. I could replicate the issue at my end. I have filed a PR for the dev team to work on it.

    Sorry for any inconvenience caused.

    #324355 Reply

    msquared
    Member

    1 month later: any updates?

    #324943 Reply

    msquared
    Member

    Just to be sure this stays on your ACTIVE list of bugs, the issue remains in the most recent 10.1 release. The test case I provided (now 7 weeks ago) still reproduces the same defect in 10.1

    #324971 Reply

    Brian Fernandes
    Moderator

    msquared,

    Sorry for the delayed response.

    This issue is caused by the fact that we have some server specific settings which force the deployment of certain libraries to some servers (even though they are typically of a “provided” nature – both with and without Maven). This is because some servers like Tomcat 6 for instance typically do not include JSTL while most others do. There is an internal setting that will force the deployment of this library to Tomcat 6 (and a few other servers) while it will typically not deploy this container to most other servers, even if it is on the classpath.

    The issue here is that this “override” setting takes precedence over even the Maven deployment settings. You will find that the bug is not reproducible with a server like JBoss for instance or most other libraries (we have these settings only for JSTL and a couple of JSF JARs).

    Thank you for highlighting the problem, my team is working on a fix for this in our next release; due to the nature of the changes required, it was not viable to put the change into 10.1. Sorry for the inconvenience caused, please let me know if you need further clarifications or assistance.

    #326645 Reply

    Brian Fernandes
    Moderator

    I wanted to update everyone on how we’ll be handling this issue.

    1) This issue is specific only to Tomcat 6, TC Server 6, MyEclipse Tomcat, Jetty 6 and Jetty 7. Furthermore, it will only occur for the jsf-api, jsf-impl and the jstl JAR files. For all other servers or other dependencies, the provided scope is respected and the JARs are not deployed.

    2) For MyEclipse 10.5, we will not be making any changes in this area due to legacy concerns and will be pushing these changes to MyEclipse 11 instead. In MyEclipse 11, the provided scope will be respected at all times, with the only possible exception being MyEclipse Tomcat. MyEclipse Tomcat will be based on Tomcat 7 instead of Tomcat 6 and we will evaluate whether the provided-override is still required.

    A possible workaround for now would be to use a Tomcat 7 server instead of a Tomcat 6 server where the override is not currently present.

    #326742 Reply

    msquared
    Member

    got it, thanks for the update.

    #352737 Reply

    gandalf902002
    Participant

    Hi,
    I have the same problem on Myeclipse Build id: 12.0.0-20131202 Version: 2014 with a WebProject with maven option deploied on resin3.
    Is there now a workaround or settings to exclude maven provided library to copy jars on lib directory ?

    Regards

    #352740 Reply

    support-swapna
    Moderator

    Hi,

    Sorry that you are seeing this issue. I could not replicate the issue with a simple maven web project at my end on MyEclipse 2014.

    Can you please send us the pom.xml to help us replicate the issue at our end? Also share with us the exact version of Resin.

    #352743 Reply

    gandalf902002
    Participant

    Hi,
    this is my pom and the version of resin is 3.1.9

    <project xmlns=”http://maven.apache.org/POM/4.0.0&#8243; xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance&#8221; xsi:schemaLocation=”http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd”&gt;
    <modelVersion>4.0.0</modelVersion>
    <groupId>httl</groupId>
    <artifactId>httl</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>war</packaging>
    <name>httl</name>
    <description/>
    <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <dependencies>
    <dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>bean-validator</artifactId>
    <version>3.0-JBoss-4.0.2</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.enterprise.deploy</artifactId>
    <version>3.0.1</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.jms</artifactId>
    <version>3.0.1</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.management.j2ee</artifactId>
    <version>3.0.1</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>org.eclipse.persistence</groupId>
    <artifactId>javax.persistence</artifactId>
    <version>2.0.0</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.resource</artifactId>
    <version>3.0.1</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.security.auth.message</artifactId>
    <version>3.0.1</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.security.jacc</artifactId>
    <version>3.0.1</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.servlet</artifactId>
    <version>3.0.1</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.servlet.jsp</artifactId>
    <version>3.0.1</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>org.glassfish</groupId>
    <artifactId>javax.servlet.jsp.jstl</artifactId>
    <version>3.0.1</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api-osgi</artifactId>
    <version>2.2.1</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>javax.ws.rs</groupId>
    <artifactId>jsr311-api</artifactId>
    <version>1.1.1</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>org.glassfish.web</groupId>
    <artifactId>jstl-impl</artifactId>
    <version>1.2</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>javax.mail</groupId>
    <artifactId>mail</artifactId>
    <version>1.4.3</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>javax.xml</groupId>
    <artifactId>webservices-api-osgi</artifactId>
    <version>2.0.1</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>org.jboss.weld</groupId>
    <artifactId>weld-osgi-bundle</artifactId>
    <version>1.0.1-SP3</version>
    <scope>provided</scope>
    </dependency>
    <dependency>
    <groupId>org.glassfish.web</groupId>
    <artifactId>javax.servlet.jsp.jstl</artifactId>
    <version>1.2.1</version>
    </dependency>
    <dependency>
    <groupId>com.github.httl</groupId>
    <artifactId>httl</artifactId>
    <version>1.0.11</version>
    </dependency>
    <dependency>
    <groupId>com.github.httl</groupId>
    <artifactId>httl-webx</artifactId>
    <version>1.0.11</version>
    </dependency>
    <dependency>
    <groupId>com.github.httl</groupId>
    <artifactId>httl-servlet</artifactId>
    <version>1.0.11</version>
    </dependency>
    <dependency>
    <groupId>org.slf4j</groupId>
    <artifactId>integration</artifactId>
    <version>1.7.7</version>
    </dependency>
    <dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
    <version>1.1.2</version>
    </dependency>
    </dependencies>
    <build>
    <sourceDirectory>src</sourceDirectory>
    <resources>
    <resource>
    <directory>src</directory>
    <excludes>
    <exclude>**/*.java</exclude>
    </excludes>
    </resource>
    </resources>
    <plugins>
    <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>2.3.2</version>
    <configuration>
    <source>1.6</source>
    <target>1.6</target>
    </configuration>
    </plugin>
    <plugin>
    <artifactId>maven-war-plugin</artifactId>
    <version>2.2</version>
    <configuration>
    <warSourceDirectory>${basedir}/WebRoot</warSourceDirectory>
    <version>3.0</version>
    <failOnMissingWebXml>false</failOnMissingWebXml>
    </configuration>
    </plugin>
    </plugins>
    </build>
    </project>

    This pom is generated from “wizard” when choose to create a new web project with Javaee6 and I add only httl-* library and slf4

    Regards

    #352782 Reply

    support-swapna
    Moderator

    Hi,

    Thank you for the POM.

    Are you deploying in Exploded or Packaged mode? Please share with us the steps you are following to deploy the project to Resin.

    Since the scope is not provided for the httl-* and the slf4j libraries, you will see the jars in the WEB-INF/lib folder after deployment. You can test by adding the scope element for these entries.

    If you are seeing any specific jars being deployed even after setting the scope as provided, please elaborate in detail to help us investigate further. If possible attach a screenshot of the WEB-INF/lib folder.

    #352799 Reply

    gandalf902002
    Participant

    Hi,
    I use the exploded mode on resin 3.1.
    I attach the screen of my web-inf\lib directory list that contanis inside all jars htt* and slf4j (correctly) and all other libraries (not correctly because are marked in maven as provided from java server.

    Attachments:
    You must be logged in to view attached files.
    #352837 Reply

    support-swapna
    Moderator

    Hi,

    Thank you for the screenshot. I am afraid it is not a bug in MyEclipse functionality.

    The jars are part of the dependencies you have added to the pom.xml and since their scope is not provided, you are seeing the list of jars deployed to WEB-INF/lib.

    You can test by adding the scope=provided to the all the dependencies excluding one dependency , update the project and deploy to see the list of jars being added for that particular dependency.

    Ex :

    <groupId>com.github.httl</groupId>
    <artifactId>httl-webx</artifactId>
    <version>1.0.11</version>

    This dependency adds the jars as shown in the below screenshot.

    Let us know if you have further questions.

Viewing 13 posts - 1 through 13 (of 13 total)
Reply To: incorrect deployment with scope=provided

You must be logged in to post in the forum log in