thebugslayer schrieb:
Hi all,
My problem is finally resolved! There are couple feedbacks I like to
give back to Maven users/developers:

1. The archetype:create plugin generate webapp that has web
descriptor(web.xml) set to version 2.3!!! big nono if you want EL
stuff to work. Would be nice to upgrade to latest, or at least 2.4

You should file a request for it in jira [1].

2. When running a webapp in a IDE(m2eclipse in my case) environment, I
can't add servlet and jsp api in the top level dependencies, as it
gets pulled into the classpath by IDE, and therefore conflicting with
the internal Web container's version. (Setting it to "provided" scope
didn't work either) The solution I have is to create a profile
dependencies in pom, and even set to activeByDefault will work!

That's how I do it, too. I have a profile 'commandline' where I put dependencies in that are auto-provided by the IDE but are not available on the command line.


And here are steps I used to start a fully working webapp with latest
Maven2+Eclipse europa(j2EE)+Tomcat6+m2eclipse plugin.

1. $ mvn archetype:create -DgroupId=cnx -DartifactId=mywebapp
-DarchetypeArtifactId=maven-archetype-webapp
2. cd mywebapp
3. mvn eclipse:m2clipse -Dwtpversion=1.5
4.  Replace pom.xml with:
http://snipplr.com/view/3774/maven2-pomxml-for-a-webapp-that-works-in-eclipse-europam2eclipse/
5. Replace src/main/webapp/WEB-INF/web.xml with:
http://snipplr.com/view/3775/minimal-web-descriptor-version-25-webxml/
6. Add any EL or JSTL to src/main/webapp/index.jsp for testing. Eg: ${header}
7. Open Eclipse and Import Existing project mywebapp
8. In eclipse, right click project and go to J2EE Module Dependencies,
check M2REPOS library.
9. Create a Server runtime with Tomcat6, Add mywebapp module, and Starts it.
10. Hit http://localhost:8080/mywebapp and test away

Thanks,
-Z

-Tim

[1] http://jira.codehaus.org/browse/ARCHETYPE


On 9/18/07, Jim Sellers <[EMAIL PROTECTED]> wrote:
Z: when you say that it's not working, do you mean on the .classpath file
for eclipse?

Does this seem like the same problem as you are having:
http://jira.codehaus.org/browse/MECLIPSE-79#action_99459

Jim


On 9/18/07, Wayne Fay <[EMAIL PROTECTED]> wrote:
Google for "maven exclusion".

Wayne

On 9/18/07, thebugslayer <[EMAIL PROTECTED]> wrote:
Max,
How would I exclude the javax.servlet:jsp-api one? I tried provided
scope, but it's still not working.

-Z

On 9/15/07, Max Bowsher <[EMAIL PROTECTED]> wrote:
thebugslayer wrote:
Hi,
I understand this problem is more of Eclipse related, but it also
involves Maven setup, so I thought maybe one of users here would
have
come across the same problem and give me some help.

I have a webapp project setup in Eclipse Europa with Tomcat6.0, and
I
am using m2eclipse plugin. In my part of my pom.xml I have the
following:

    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.5</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>javax.servlet.jsp</groupId>
      <artifactId>jsp-api</artifactId>
      <version>2.1</version>
      <scope>provided</scope>
    </dependency>

When I run it inside eclipse, the webapp startup fine, but when I
hit
any jsp page I get the following:

SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 22 in the generated java file
The method getJspApplicationContext(ServletContext) is undefined for
the type JspFactory
Part of the issue may be that the 2.0 jsp-api is erroneously published
under two different names in the central Maven2 repository:

 * javax.servlet.jsp:jsp-api
 * javax.servlet:jsp-api

thus causing Maven to potentially put one of each name on the
classpath.
It would be necessary to add a dependency exclusion for the
javax.servlet:jsp-api version to any dependencies which are
transitively
pulling it in.


Max.





--
/bugslayer

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to