By default the Gradle Ear plugin automatically generated the context-root element for each web module. The context-root appears to be the artifact name with the extension stripped off.
The problem with the default is that the context-root is going to change every time the version web module’s version changes. That’s not going to work for my needs and I would assume for others as well. We need to set a constant context-root regardless of the version on the artifact.
Is there some way to override the default value for the context-root?
I guess I didn’t mention it in the original post but I am referring to the context-path element in the application.xml file. See below for ran example of an application.xml file generated by the Ear plugin:
Does this solution still work? I’m getting following error if I use
project(":my-war").war.archiveName
inside the ear task:
Could not find property 'war' on project ':my-war'.
I also cannot use any variables as archive name that are setup by a task, even if the ear task depends on this custom task. It seems that the values are evaluated before the war project is even loaded or the custom task executed.