2

The context root file from Wildfly AS looks like this (it must be put in a file name jboss-web.xml as explained here :

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

This file and its content have to be copied into the WEB-INF folder of the WAR file.

Of course I can manually add this file after the build and it works. But is there a way to do it automatically ? Is there in JHipster any folder that copies its content to the WEB-INF folder ? (Could be great to add such container specific files)

Community
  • 1
  • 1
Mathieu
  • 365
  • 2
  • 9

2 Answers2

1

You can put the file in /src/main/webapp/WEB-INF and it will work.

This goes against our goal of an "XML free" configuration, but that's how Wildfly works... BTW I am not sure you can get Spring working on Wildfly, with its broken classloader.

Julien Dubois
  • 3,678
  • 1
  • 20
  • 22
0

If you are using gradle, after copying yours files into /src/main/webapp/WEB-INF/ you have to add webInf { from 'src/additionalWebInf' } // to add a file-set to the WEB-INF dir. on the file gradle/war.gradle the file will look like this

apply plugin: "war"

bootWar {
    mainClassName = "com.mycompani.JhtestApp"
    includes = ["WEB-INF/**", "META-INF/**"]
    webInf { from 'src/main/webapp/WEB-INF/' } // this copy all files under this location
    //webInf { from 'src/main/webapp/WEB-INF/jboss-web.xml' } //this copy this single file
}

war {
    webAppDirName = "build/resources/main/static/"
    enabled = true
    archiveExtension = "war.original"
    includes = ["WEB-INF/**", "META-INF/**"]  
    webInf { from 'src/main/webapp/WEB-INF/' } // this copy all files under this location
    //webInf { from 'src/main/webapp/WEB-INF/jboss-web.xml' } //this copy this single file
}

I hope it is useful for you. for more help visit https://docs.gradle.org/current/userguide/war_plugin.html

Potemkin
  • 59
  • 4