Changing default filesystem in WAR file prepared by Gradle plugin - gradle

I would like to deploy a mock service developed with SoapUI. I have SoapUI project, web.xml and now I would like to add them to WAR archive. I'm using Gradle to prepare this WAR file.
My code below:
war {
archiveName 'mock.war'
webXml file ('src/main/webapp/web.xml')
}
Default filesystem of produced archive is:
META-INF
WEB-INF
lib
some libs...
classes (this folder I would like to rename to 'soapui')
some files...
web.xml
Is there any possibility, to change the name of 'classes' folder?
Thanks in advance,
Patryk

Related

Gradle ear plugin generating two application.xml file

I have sample project (sample-project) and have a META-INF folder directly under the project and it has three files( application.xml, A.xml and B.xml) when I generate the ear, the build is successful, but the ear META-INF has an additional application.xml file generated by the script.
How can I avoid the additional application.xml file?
Put your META-INF files under src/main/resources and modify the build
ear {
appDirName 'src/main/resources'
}

How to add a xml a file as dependency using gradle?

I have a project build on gradle and it has a directory src/main/dist/deploy. In deploy folder there is a xml file. This xml file i want to add as a dependency in the jar file which my build.gradle is generating. This jar i am adding in the lib folder of another project that has a dependency on my gradle project. The other project is built using ant. When classes bundled in gradle jar are loaded from ant project they are unable to read that xml file from the gradle jar.
The standard java plugin does not look in src/main/dist/deploy for resources.
You should either move the xml file into java plugin's standard resource folder src/main/resources, or add the dist/deploy folder to your main sourceSet's resource list.

How to add folder inside src/main/app in Mule project directly inside zip file and not in classes when building using maven

I have a folder named webapps inside my src/main/app in mule project. This webapps folder contains a war which is exposed in mule-config.xml through jetty connector. I tried lot of combinations in my maven build but this webapps folder ends up inside classes in zip file. I want it right inside zip.
Any pointers how to achieve it in pom?
Try using the maven ant plugin.
File can be moved around after compilation and before packaging.
phase: prepare-package (just before packing)
https://maven.apache.org/guides/mini/guide-using-ant.html
Hope this helps.
Since couldn't get maven to build zip file in a way that it would copy webapps folder directly under root. I ended up placing webapps folder containing war file inside src/main/resources. Maven build copied webapps folder under classes. And the mule-config referred it as
<jetty:connector name="Jetty" doc:name="Jetty">
<jetty:webapps port="${jetty.port}" host="${jetty.host}" directory="${app.home}/classes/webapps" />
</jetty:connector>

Maven : should I put xml files in src/main/java folder?

We've got many beans.xml and struts.xml files located in src/main/java folder. When mvn package is finished, I couldn't find those files in WEB-INF/classes folder.
Is it wrong to put xml files in src/main/java? Should I put them in src/main/resources instead? Or should I modify the pom.xml?
The standard is to place them into src/main/resources They will end up going into WEB-INF/classes when the war is packaged by maven.

How to place context.xml in war's META-INF?

I am building a webapp through Gradle's war plugin. In order to disable Tomcat's session persistence, I need to place the file context.xml in the META-INF directory of the war's root.
I attempted the following:
Create the file src/main/webapp/META-INF/context.xml of the main project
Create the file src/main/resources/META-INF/context.xml of the main project
However, when I build the project using gradle clean war, the produced war file contains a META-INF with only a MANIFEST.MF in it. It is as if my directory gets overridden.
How do I place context.xml in the war?
src/main/webapp/META-INF/context.xml is correct and works fine for me. Chances are that you went wrong somewhere, or that there is a problem with your build script.

Resources