Wildfly in Eclipse is adding the Maven SNAPSHOT to the web context
Asked Answered
W

4

9

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.

Wholewheat answered 6/9, 2016 at 20:37 Comment(4)
Did you try to do Right-click > Maven > Update project... on your project? Also, you could consider giving a try to JBoss Tools.Middlebrooks
This is odd. And another developer here confirmed it on his computer. We rolled back from STS based on Eclipse Neon to STS based on Eclipse Mars and it works fine.Wholewheat
Spoke too soon. Reverting to Mars fixed some of the projects but not others.Wholewheat
same problem here. what do you mean by STS and how did you change it?Acutance
C
16

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.

Cherin answered 9/11, 2016 at 21:9 Comment(3)
To the point solution..perfectly worked..I am using eclipse -jboss studio plugin...Wildfly 10...Patricepatrich
..awsm answer, save my dayVerdugo
I apologize if this is trivial, but I am really new to Eclipse and Java environment. Where should I place the WEB-INF folder?Rudyrudyard
T
5
  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.
Theda answered 17/6, 2017 at 2:58 Comment(0)
M
1

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?

Marquita answered 7/9, 2016 at 12:38 Comment(2)
Yes, I tried the name attribute with no luck. I haven't tried building the war outside of Eclipse with mvn install. However, rolling back from STS based on Neon to STS based on Mars seems to have fixed it.Wholewheat
This worked for me. However, I had to close the project, remove the resource from wildfly, and restart eclipse.Chatham
A
0

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.

Acutance answered 26/1, 2017 at 13:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.