Wildfly in Eclipse is adding the Maven SNAPSHOT to the web context

4.2k Views Asked by At

I'm having a new problem when we moved to a Wildfly 8.x server in eclipse.

My project is called PayloadSvc. The first part of the pom.xml looks like this:

<modelVersion>4.0.0</modelVersion>
<groupId>PayloadSvc</groupId>
<artifactId>PayloadSvc</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>

Later in the pom I have this:

<build>
    <finalName>PayloadSvc</finalName>

In eclipse I also have my context root in the Web Project Settings set to PayloadSvc

However, when it deploys into Wildfly it deploys this way:

Registered web context: /PayloadSvc-0.0.1-SNAPSHOT

I can't seem to get it to remove the "-0.0.1-SNAPSHOT" part of the web context.

Oddly enough, other projects in the same workplace work correctly even with the same pom data (with appropriate context, groupId, artifact Id, and the same version attribute of course).

I'm using the STS version of Eclipse Neon.

Thank you for any advice you may have.

4

There are 4 best solutions below

2
alexanderific On

Have you tried adding the <name>PayloadSvc</name> element in the root of the pom (same spot as your group,artifact,version elements)?

If that doesn't help, what does the artifact look like when you build it with mvn install? Does it include the version number in the war filename?

3
a_netanel On

Just had the same problem solved. If you don't have it already, create a WEB-INF\jboss-web.xml file, with the following content:

<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
    <context-root>PayloadSvc</context-root>
</jboss-web>

Republish the resource and you're done. Not sure why the file is not created automatically though.

0
Solano On

For Eclipse Neon:

1 Did a Eclipse Neon 'Check for updates' and updated it.

2 I editted file org.eclipse.wst.common.component adding a blank line and saved (check if deploy-name is suffixed with SNAPSHOT).

3 After that the suffix '0.0.1-SNAPSHOT' disappear from the war name when adding it to Wildfly server.

0
Allan Veloso On
  1. Edit the file \[root-of-your-project]\.settings\org.eclipse.wst.common.component, changing the deploy-name attribute and context-root value.
  2. Show the server tab by: Window > Show View > Server
  3. Right click on your server then Add and Remove.... Remove all projects from server.
  4. Right click on your server and clean.
  5. Just to be sure, go to the directory where WildFly is installed and delete the content of the directory [wildfly-path]\[standalone-path]\deployments, if it exits.
  6. Add again the projects into your server and run.