Problem launching WTP on Tomcat server

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem launching WTP on Tomcat server

Nikola Milutinovic-2
Hi all.

I have a problem, for which I think I know what the root cause is, but I don't what to do with it.

Eclipse Galileo SR1 64bit
m2eclipse 0.9.9.200912160759
Tomcat 6.0.24
JDK 1.6.0 u18 64bit
Windows 7 64bit

I have a normal Maven2 multimodule project, where the main target is the web application module. If I build the WAR and deploy it on the Tomcat, it will run. It also runs from "mvn org.mortbay.jetty:jetty-maven-plugin:run".

If I define a server in Eclipse and deploy this project (the web module) on the server, launching fails, stating it cannot find one of Spring's context files. It is actually the first context file listed in imports, so it is safe to assume that they all fail. The context file is in src/main/resources.

I inspected the location where Eclipse WTP deploys the web application and I have noticed that not a single resource has been placed there, only Java class files. Then it hit me - resource filtering.

m2eclipse sets "Exclude: *.*" on resource folders, in order not allow Eclipse to trample the resources filtered by m2eclipse with the unfiltered ones. Apparently this causes WTP not to include those resources into web application deployment, which breaks my setup.

So, what am I to do?

Is this some glitch in how I have set up the application server in Eclipse? I do realize WTP should be picking up resources from target/classes, but maybe it wants to avoid messy situations and does deployment from source directories (doing a proper build first).

I can turn off the exclusion or turn on inclusion to pick up context files, but I am aware that it is not ideal.

Any suggestions?

Nix.

Reply | Threaded
Open this post in threaded view
|

Re: Problem launching WTP on Tomcat server

David Durham, Jr.
On Fri, Feb 5, 2010 at 10:49 AM, Nikola Milutinovic <[hidden email]> wrote:
> I inspected the location where Eclipse WTP deploys the web application and I
> have noticed that not a single resource has been placed there, only Java
> class files. Then it hit me - resource filtering.


Yeah, I noticed that if I do a 'run as -> maven build .. ->
resources:resources ' and refresh the project .. the resources make
into the wtp internal deploy directory.

I think there's a way to hook that into the auto build process.

I also got a tip to put this in my pom.xml:


    <profiles>
        <profile>
            <id>m2e</id>
            <activation>
                <property>
                    <name>m2e.version</name>
                </property>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.maven.ide.eclipse</groupId>
                        <artifactId>lifecycle-mapping</artifactId>
                        <version>0.9.9-SNAPSHOT</version>
                        <configuration>
                            <mappingId>customizable</mappingId>
                            <configurators>
                                <configurator
id='org.maven.ide.eclipse.jdt.javaConfigurator' />
                            </configurators>
                            <mojoExecutions>

<mojoExecution>org.apache.maven.plugins:maven-resources-plugin::</mojoExecution>
                            </mojoExecutions>
                        </configuration>
                    </plugin>
                </plugins>
                <pluginManagement>
                    <plugins>
                        <plugin>
                            <groupId>org.apache.maven.plugins</groupId>
                            <artifactId>maven-resources-plugin</artifactId>
                            <version>2.4</version>
                        </plugin>
                    </plugins>
                </pluginManagement>
            </build>
        </profile>


    </profiles>


HTH,
Dave

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Problem launching WTP on Tomcat server

Fred Bricon
Nikola, you've hit https://issues.sonatype.org/browse/MNGECLIPSE-823
David's suggestion is correct. But when using the lifecycle mapping plugin for war, ejb and ear projects, you have to add the WTP configurator  :

   <configurator id='org.maven.ide.eclipse.configuration.wtp.configurator' />

Also note that ear projects shouldn't use org.maven.ide.eclipse.jdt.javaConfigurator

regards,

Fred Bricon

On Fri, Feb 5, 2010 at 10:53 PM, David Durham <[hidden email]> wrote:
On Fri, Feb 5, 2010 at 10:49 AM, Nikola Milutinovic <[hidden email]> wrote:
> I inspected the location where Eclipse WTP deploys the web application and I
> have noticed that not a single resource has been placed there, only Java
> class files. Then it hit me - resource filtering.


Yeah, I noticed that if I do a 'run as -> maven build .. ->
resources:resources ' and refresh the project .. the resources make
into the wtp internal deploy directory.

I think there's a way to hook that into the auto build process.

I also got a tip to put this in my pom.xml:


   <profiles>
       <profile>
           <id>m2e</id>
           <activation>
               <property>
                   <name>m2e.version</name>
               </property>
           </activation>
           <build>
               <plugins>
                   <plugin>
                       <groupId>org.maven.ide.eclipse</groupId>
                       <artifactId>lifecycle-mapping</artifactId>
                       <version>0.9.9-SNAPSHOT</version>
                       <configuration>
                           <mappingId>customizable</mappingId>
                           <configurators>
                               <configurator
id='org.maven.ide.eclipse.jdt.javaConfigurator' />
                           </configurators>
                           <mojoExecutions>

<mojoExecution>org.apache.maven.plugins:maven-resources-plugin::</mojoExecution>
                           </mojoExecutions>
                       </configuration>
                   </plugin>
               </plugins>
               <pluginManagement>
                   <plugins>
                       <plugin>
                           <groupId>org.apache.maven.plugins</groupId>
                           <artifactId>maven-resources-plugin</artifactId>
                           <version>2.4</version>
                       </plugin>
                   </plugins>
               </pluginManagement>
           </build>
       </profile>


   </profiles>


HTH,
Dave

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

   http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Problem launching WTP on Tomcat server

David Durham, Jr.
On Fri, Feb 5, 2010 at 6:37 PM, Fred Bricon <[hidden email]> wrote:
> Nikola, you've hit https://issues.sonatype.org/browse/MNGECLIPSE-823
> David's suggestion is correct. But when using the lifecycle mapping plugin
> for war, ejb and ear projects, you have to add the WTP configurator  :
>
>    <configurator id='org.maven.ide.eclipse.configuration.wtp.configurator'
> />
>
> Also note that ear projects shouldn't use
> org.maven.ide.eclipse.jdt.javaConfigurator


Which file gets this <configurator> element?  Is that the .project?

Thanks,
Dave

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Problem launching WTP on Tomcat server

Nikola Milutinovic-2
Well, the element is supposed to go into the POM, under a profile section.

Now, I must report that this is not working. Or at least not any more. It worked at some point, but now it is back to the usual - resources not being published to TC deployment area. Let me clarify what I have done. I have added this to my POM in the web module:

<profile>
    <id>m2eclipse</id>
    <activation>
        <property>
            <name>m2e.version</name>
            <value>0.10.0</value>
        </property>
    </activation>
    <build>
        <plugins>
            <plugin>
                <groupId>org.maven.ide.eclipse</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>0.10.0</version>
                <configuration>
                    <mappingId>customizable</mappingId>
                    <configurators>
                        <configurator id="org.maven.ide.eclipse.jdt.javaConfigurator" />
                        <configurator id="org.maven.ide.eclipse.configuration.wtp.configurator" />
                    </configurators>
                    <mojoExecutions>
                        <mojoExecution>org.apache.maven.plugins:maven-resources-plugin::</mojoExecution>
                    </mojoExecutions>
                </configuration>
            </plugin>
        </plugins>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-resources-plugin</artifactId>
                    <version>2.4</version>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</profile>

This has had one positive effect, though. Before I had the wtp.configurator in, my project was not imported as a WTP project. Now, if I do an "update configuration", it gets set up as a proper WTP project. Could it be due to the fact that I have a similar fragment in the parent POM, that only has javaConfigurator? So, it is overriding default behaviour? Or was that fragment in the web's POM overriding it?

So, my question is, is this really what is needed to get the WTP publishing to TC directory to copy the resources, which are otherwise ignored, due to the fact that there is an exclusion on that source directory? Is it perhaps fixed in the latest version of plugin?

Do we have any public resources/docs about these configurators?

Something is still missing in my config and I do not know what it might be, since this is "terra incognita" for me.

Nix.

From: David Durham <[hidden email]>
To: [hidden email]
Sent: Mon, February 8, 2010 8:21:16 PM
Subject: Re: [m2eclipse-user] Problem launching WTP on Tomcat server

On Fri, Feb 5, 2010 at 6:37 PM, Fred Bricon <[hidden email]> wrote:
> Nikola, you've hit https://issues.sonatype.org/browse/MNGECLIPSE-823
> David's suggestion is correct. But when using the lifecycle mapping plugin
> for war, ejb and ear projects, you have to add the WTP configurator  :
>
>    <configurator id='org.maven.ide.eclipse.configuration.wtp.configurator'
> />
>
> Also note that ear projects shouldn't use
> org.maven.ide.eclipse.jdt.javaConfigurator


Which file gets this <configurator> element?  Is that the .project?

Thanks,
Dave

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

    http://xircles.codehaus.org/manage_email