Thanks Fred, that works good enough for me :) I can run my application under WTP now!

I ended up with the following configuration:

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<!-- override web.xml for development mode -->
<webXml>src/main/webapp-eclipse/WEB-INF/web.xml</webXml>
<!-- workaround for https://issues.sonatype.org/browse/MNGECLIPSE-2357 -->
<webResources>
<resource>
<directory>src/main/webapp-eclipse</directory>
<filtering>true</filtering>
</resource>
</webResources>
</configuration>
</plugin>

It works both inside eclipse and in command line with -Peclipse, which I believe, will be necessary for running under webby.

thanks,
Rafał

On 07/05/2011 05:21 PM, Fred Bricon wrote:
This is a limitation in m2e-wtp and WTP itself (https://issues.sonatype.org/browse/MNGECLIPSE-2357?focusedCommentId=118395&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-118395 <https://issues.sonatype.org/browse/MNGECLIPSE-2357?focusedCommentId=118395&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-118395>)

As a workaround, you can :
- create a folder /src/main/eclipse/
- move src/main/webapp/WEB-INF/eclipse-web.xml to /src/main/eclipse/web.xml
- declare a webResource in your maven-war-plugin config :
         <configuration>
           <webResources>
             <resource>
               <directory>src/main/eclipse</directory>
               <targetPath>WEB-INF</targetPath>
               <filtering>true</filtering>
             </resource>
           </webResources>
         </configuration>
regards,

Fred Bricon

2011/7/5 Rafał Krzewski <[email protected] <mailto:[email protected]>>

    That worked, and the application got deployed _almost_ correctly.

    I have two files in src/main/webapp/WEB-INF/ - web.xml for regular
    deployment and eclipse-web.xml for running the application in
    development mode. The latter needs filtering to substitute some
    workspace specific paths.

    I have the following profile definition in the POM:

    <profile>
    <id>eclipse</id>
    <build>
    <plugins>
    <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-war-plugin</artifactId>
    <configuration>
    <webXml>src/main/webapp/WEB-INF/eclipse-web.xml</webXml>
    </configuration>
    </plugin>
    </plugins>
    </build>
    </profile>

    Profile is activated directly in project > Properties > Maven >
    Active Maven profiles.

    This sort of worked in my older m2e 0.10 + JBoss Project Archives
    setup, but when I deployed the application with current m2e-wtp
    and checked
    org.eclipse.wst.server.core/tmp0/wtpwebapps/cyklotron-webapp/WEB-INF
    I found that no web.xml file, but a non-filtered copy
    eclipse-web.xml instead. I remember that I've run into similar
    problem when I tried updating to m2e-wtp 0.12 a while ago. Is this
    a known issue? Any workarounds?

    cheers,
    Rafał



    On 07/05/2011 04:01 PM, Fred Bricon wrote:
    You should remove the utility facet from these projects (in the
    project properties), before updating their maven configuration.
    m2e-wtp doesn't cope well with this kind of packaging change.

    2011/7/5 Rafał Krzewski <[email protected]
    <mailto:[email protected]>>

        I've switched my projects to war packaging with attached jars
        and now I'm getting the following two errors for each project:

        Utility Module and Dynamic Web Module 2.5 cannot both be
        selected.
        One or more constraints have not been satisfied.

        This makes sense, as much as I understand how WTP works. It
        seems that to get around this, I would need to get rid of the
        attached jars and package the classes in WEB-INF/classes.
        Then again I need those classes as compile time dependencies
        for other modules, and while I suspect it might work under
        Eclipse/WTP, putting a war on compile classpath under
        standalone Maven probable would not work...

        My previous setup using jars with attached wars was
        admittedly a bit convoluted, but war overlays contributing
        both classes and webResources seems pretty much standard
        usage. Am I missing something here?

        cheers,
        Rafał


        On 07/05/2011 01:23 PM, Fred Bricon wrote:
        m2e-wtp doesn't support overlays of projects handled as
        attached artifacts.

        Regards,

        Fred Bricon

        2011/7/5 Rafał Krzewski <[email protected]
        <mailto:[email protected]>>

            Hi,

            I've just tried running a web application with webby
            0.1.0.201106240305 and it failed to start with message
            "Could not locate configuration for maven-war-plugin".

            Here's POM for the war project I was trying to launch:
            
http://objectledge.org/fisheye/browse/cyklotron/trunk/cyklotron-webapp/pom.xml?hb=true#to105

            As you can see maven-war-plugin configuration definitely
            is in there :). I looked at the target directory and
            I've noticed that m2e-webby directory was created and
            some of the application contents were unpacked into it.
            Judging from what has been unpacked and what hasn't I'm
            guessing that overlays coming from projects that have
            war packaging were processed correctly. There are
            however overlays coming from wars generated as attached
            artifacts. See
            
http://objectledge.org/fisheye/browse/cyklotron/trunk/cyklotron-ui/pom.xml?r=9827#to77
            and
            
http://objectledge.org/fisheye/browse/ledge/trunk/ledge-maven-assemblies/src/main/resources/assemblies/content-war.xml?hb=true.
            This works with standalone maven build. I haven't
            checked yet if current m2e-wtp can handle it. 0.12.x and
            lower definitely could not. I don't know if it's
            supposed to be in webby. Even if not, more informative
            error message would be nice.

            As I think about it, I could flip things over and change
            the packaging of these non-standard projects to war and
            generate jars with classes as attached artifacts
            instead. War plugin has a configuration option for this
            if I remember correctly. That would actually make things
            less complicated. I'll try that and let you know if it
            fixes webby problem I've run into.

            cheers,
            Rafał
            _______________________________________________
            m2e-users mailing list
            [email protected] <mailto:[email protected]>
            https://dev.eclipse.org/mailman/listinfo/m2e-users




-- "Have you tried turning it off and on again" - The IT Crowd


        _______________________________________________
        m2e-users mailing list
        [email protected]  <mailto:[email protected]>
        https://dev.eclipse.org/mailman/listinfo/m2e-users


        _______________________________________________
        m2e-users mailing list
        [email protected] <mailto:[email protected]>
        https://dev.eclipse.org/mailman/listinfo/m2e-users




-- "Have you tried turning it off and on again" - The IT Crowd


    _______________________________________________
    m2e-users mailing list
    [email protected]  <mailto:[email protected]>
    https://dev.eclipse.org/mailman/listinfo/m2e-users


    _______________________________________________
    m2e-users mailing list
    [email protected] <mailto:[email protected]>
    https://dev.eclipse.org/mailman/listinfo/m2e-users




--
"Have you tried turning it off and on again" - The IT Crowd


_______________________________________________
m2e-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/m2e-users

_______________________________________________
m2e-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/m2e-users

Reply via email to