So i'm trying to configure Maven Liberty Plugin to point to my war application in exploded format.
I'm able to do this for .war file but having issues with the constraint of having to have my project exploded in a directory named ../somewarfile.war/ this is an issue since my build also packages in this folder. I can't have both a .war file and .war directory in the same Maven Target Folder.
Is there a way to use exploded archive without having to name my folder somewarfile.war
You can configure the Liberty Maven Plug-in with a custom server.xml. That server.xml can have a webApplication element that points to the directory of the exploded war file.
For example, create your custom server.xml under src/main/wlp directory with:
...
<webApplication location="./target/myApp/" name="myApp"/>
...
Of course, the location attribute needs to be point to the right location.
And the Liberty Maven Plug-in is configured with:
<configuration>
...
<configFile>src/main/wlp/server.xml</configFile>
...
</configuration>
Related
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
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>
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.
JSF (com.sun.faces 2.1.12) cannot find annotated classes in target/classes when run with the tomcat7 maven plugin (v2.2).
When we debug we run the application using the tomcat7:run plugin with Maven. When the tomcat7 plugin builds the classpath for the webapp as it launches it adds target/classes to the webapp classpath as a classes directory and configures src/main/webapp as the webapp root directory. What this means is that there are no classes in WEB-INF/classes and the com.sun.faces annotation scanner does not scan target/classes for #ManagedBeans.
I tried tricking the annotation scanner into scanning target/classes by adding a META-INF/faces-config.xml to src/main/resources. This almost worked as the MET-INF/faces-config.xml was found in target/classes but com.sun.faces.config.ConfigManager.ProvideMetadataToAnnotationScanTask skipped it because it was not in a jar. I've had difficulty finding the code that scans WEB-INF/classes.
How can I convince com.sun.faces to scan my target/classes directory for #ManagedBeans?
which version of the plugin are you using?
That's normally fixed in 2.2 (see http://tomcat.apache.org/maven-plugin-2.2/tomcat7-maven-plugin/run-mojo.html#jarScanAllDirectories )
If not could you please create an issue with a sample project?
Thanks
Create in your Maven project the file src/main/tomcatconf/context.xml
with the following content:
<?xml version='1.0' encoding='utf-8'?>
<Context>
<Resources
className="org.apache.naming.resources.VirtualDirContext"
extraResourcePaths="/WEB-INF/classes=target/classes"/>
</Context>
The Tomcat 7 Maven plug-in looks up this file at startup. The implementation
org.apache.naming.resources.VirtualDirContext of the Context interface allows
the mapping of directories to certain resource locations. In this case we map
the directory of the project's classes to the resource /WEB-INF/classes.
I have a Maven project. It is successfully deploying the jar file. I also want it to deploy the contents of src/main/resources.
mvn deploy does not deploy the resources.
How can I make it do that?
I read about using the copy file task and other workaround methods, but I want to use Maven's default behavior for deploying, which I thought would include the resources.
The folder src/main/resources contains resources which will be packaged into the jar file which means in other words it is already deployed within the created jar file.