Run with Netbeans (and Maven) the right context root
Asked Answered
P

2

4

I've got a little problem when I run a project from my Netbeans 7.2 (I also use a Glassfish 3.1.2 Server) ...

In fact I'm migrating existing projects from Ant to Maven, my pom.xml are finished and I've used the customisation of the context root as it's described here : http://maven.apache.org/plugins/maven-ear-plugin/examples/customizing-context-root.html but when I run the project from netbeans, it's deployed with the name of my .ear : localhost:8080/MyApplicationEAR-0.1-SNAPSHOT instead of localhost:8080/MyApplicationName (which is referenced in <contextRoot>/MyApplicationName</contextRoot>)

If I write the correct URL in my browser it works fine but it's not really pleasant.

Is there a problem in Netbeans or I've forgot something?

EDIT : The application.xml is auto generated by Maven and the context-root is well formed but it seems that Netbeans doesn't matter with this...

Phenomenalism answered 5/11, 2012 at 12:51 Comment(0)
A
4

If you are using Maven and deploying into JBoss, try this.

You should edit the pom.xml file and add the following line into <build> section.

<finalName>${artifactId}</finalName>
Ascus answered 4/10, 2013 at 6:0 Comment(0)
C
2

I just tried that with Netbeans 7.3 beta and it works.

I assume you put in the artifact and groupId tags in your module tag. If not this might be your problem. Here my plugin config as an example:

         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-ear-plugin</artifactId>
            <version>2.8</version>
            <configuration>
                <version>6</version>
                <defaultLibBundleDir>lib</defaultLibBundleDir>
                <generateApplicationXml>true</generateApplicationXml>
                <applicationName>Gen</applicationName>
                <modules>
                    <ejbModule>
                        <artifactId>Testing-ejb</artifactId>
                        <groupId>de.roeperweise.testing</groupId>
                        <bundleFileName>ejb.jar</bundleFileName>
                    </ejbModule>
                    <webModule>
                        <artifactId>Testing-web</artifactId>
                        <groupId>de.roeperweise.testing</groupId>
                        <bundleFileName>web.war</bundleFileName>
                        <contextRoot>/custom</contextRoot>                         
                    </webModule>
                </modules>
            </configuration>
        </plugin>
Conversational answered 11/1, 2013 at 15:10 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.