I am trying to get the Cargo plugin works on my maven project in order to benefit from war hot-deployment targetting the Jonas server.
The official documentation is not that clear on what is supported and what is not (for example you can find this: http://cargo.codehaus.org/Hot+Deployment but also this http://cargo.codehaus.org/JOnAS+4.x).
Anyway I have the following coniguration in for my war's POM:
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0</version>
<configuration>
<container>
<containerId>jonas4x</containerId>
<home>C:\JOnAS-4.8.4\nt\bin</home>
</container>
<configuration>
<type>existing</type>
<home>C:\JOnAS-4.8.4</home>
</configuration>
</configuration>
</plugin>
And when I run
mvn cargo:deploy
on my project, the war is copied to the Jonas webapps folder but there is no hot deployment. The file is only copied but the hot deploy Jonas command is not called so that my modifications are not available immediatly.
EDIT: I also tried to add a deployer configuration as suggested on the answers but the behaviour is the same (ie: war is copied but the Jonas hot deploy command is not called so that the war is not reloaded in Jonas).
Am I missing something or am I right saying the Cargo Maven plugin does not support Jonas Hot Deployement?
Thanks in advance!
The cargo page on deploying to a running container links to a table listing the version where hot deployment was introduced for that container. According to the table, JOnAS 4.x is supported from version 1.0 (which you are using), so it should work.
On that page it also has some guidelines for configuring the plugin for deployment, I've attempted to interpret them below.
From the home element in your configuration I assume you are attempting a local deployment. The configuration in the running container page implies that the hot-deployment should be automatic in this line at the end:
Just type mvn cargo:deploy. Notice that we haven't specified a element nor a one. This is because the plugin is smart enough to create default instances for you. Cool, isn't it?
However the earlier configuration block indicates you should configure the deployer section to make the cargo plugin aware of the war to be deployed. The configuration for the deployer would be something like this:
<deployer>
<type>local</type>
<deployables>
<deployable>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<type>war</type>
<properties>
<context>optional root context</context>
</properties>
<pingURL>optional url to ping to know if deployable is done or not</pingURL>
<pingTimeout>optional timeout to ping (default 20000 milliseconds)</pingTimeout>
</deployable>
</deployables>
</deployer>
If the automatic option isn't working for you, consider declaring the configuration for your war.
Related
I'm trying to deploy a war file for local development and I want to modify tomcat's context.xml to provide datasource via jndi. This works when using tomcat7-maven-plugin:
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<contextFile>../../tomcat-test-context.xml</contextFile>
</configuration>
</plugin>
The problem is, that tomcat7-maven-plugin doesn't work with overlays which I use in the project, so I have to use another approach. I can deploy the war artifact in intellij idea, but I don't see any option to specify the contextFile like in the tomcat7-maven-plugin. Is there some option to do similar thing in intellij idea tomcat configuration?
Of course I can modify the context.xml under the catalina home, but I'd like to have it configured per project and don't want to have many tomcats.
The application is deployed on weblogic in production and I use tomcat only locally for testing.
I need to run Apache ServiceMix on servers with no direct connection to the internet. I am unable to find a "full" assembly for Apache ServiceMix 5.1.4. An older version of ServiceMix (4.5.3) has a full version available for download.
Is a full version of 5.1.4 is available and if so where?
http://servicemix.apache.org/downloads/servicemix-5.1.4.html
http://servicemix.apache.org/downloads/servicemix-4.5.3.html
Starting with ServiceMix 5.0.0 we have removed the full and minimal assemblies and we provide only the default assembly which only includes bundles used by default boot features (please see discussion under http://servicemix.396122.n5.nabble.com/DISCUSS-Which-assemblies-to-keep-around-td5719173.html)
If you have a project you want to deploy on the ServiceMix, you can add a new module to your project that runs the add-features-to-repo goal of the features-maven-plugin and zips everything up. Next you can deliver the zip file with all the bundles for
all the features you need to install on ServiceMix.
Thanks to KSobkowiak's answer which pointed me in the right direction. I am posting the steps I used to get a custom ServiceMix 5.x up and running in case anyone else needs to do the same. The instructions assume Linux, but windows steps should be similar.
1) Download and unzip ServiceMix and Maven
cd /opt
unzip apache-servicemix-5.1.4.zip
unzip apache-maven-3.0.3.zip
2) Configure maven proxy, if needed:
3) Create a maven project directory
mkdir serviceMix_features
cd serviceMix_features
4) Create a maven pom file with the following xml. I got the list of descriptors by running features:listurl command in the servicemix console. The features would be whatever you need in your custom servicemix distro, in this case I am adding the webconsole and several camel components.
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>my.group</groupId>
<artifactId>custom-servicemix</artifactId>
<version>1.0</version>
<packaging>pom</packaging>
<name>My custom service mix repository</name>
<build>
<plugins>
<plugin>
<groupId>org.apache.karaf.tooling</groupId>
<artifactId>features-maven-plugin</artifactId>
<version>2.3.9</version>
<executions>
<execution>
<id>add-features-to-repo</id>
<phase>generate-resources</phase>
<goals>
<goal>add-features-to-repo</goal>
</goals>
<configuration>
<descriptors>
<descriptor>mvn:org.apache.camel.karaf/apache-camel/2.13.3/xml/features</descriptor>
<descriptor>mvn:org.apache.servicemix/apache-servicemix/5.1.4/xml/internal</descriptor>
<descriptor>mvn:org.apache.activemq/activemq-karaf/5.10.0/xml/features</descriptor>
<descriptor>mvn:org.apache.karaf.assemblies.features/standard/2.3.9/xml/features</descriptor>
<descriptor>mvn:org.apache.karaf.assemblies.features/enterprise/2.3.9/xml/features</descriptor>
<descriptor>mvn:org.apache.jclouds.karaf/jclouds-karaf/1.7.2/xml/features</descriptor>
<descriptor>mvn:org.apache.cxf.karaf/apache-cxf/2.7.13/xml/features</descriptor>
<descriptor>mvn:org.apache.servicemix/apache-servicemix/5.1.4/xml/features</descriptor>
<descriptor>mvn:org.apache.servicemix/apache-servicemix/5.1.4/xml/examples</descriptor>
<descriptor>mvn:org.ops4j.pax.cdi/pax-cdi-features/0.8.0/xml/features</descriptor>
<descriptor>mvn:org.apache.activemq/activemq-karaf/5.10.0/xml/features-core</descriptor>
</descriptors>
<features>
<feature>webconsole</feature>
<feature>camel-restlet</feature>
<feature>camel-jackson</feature>
</features>
<repository>target/features-repo</repository>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
5) Execute the maven project. I noticed that sometimes maven would get part way through and fail. After retrying, I noticed that it pulled in additional jars each run, and finnally succeeded on the fourth try.
/opt/apache-maven-3.0.3/bin/mvn install
6) Overlay the maven files on the default service mix distro.
cp -Rvn target/features_repo/* /opt/apache-servicemix-5.1.4/system/
7) zip or tar your custom service mix distro and move it where you need to. If you were using a proxy, you can deconfigure the maven proxy and clear your maven repo to verify service mix was correctly updated from the service mix console.
features:install webconsole
You can find all releases from ASF from the Apache archive. For ServiceMix it is here: http://archive.apache.org/dist/servicemix/
I have a project where I am packaging a WAR using simple maven-war-plugin. Along with all other dependencies one of the dependency say 'abc.jar' which is getting packaged in war contains a default spring configurations which I would like to update with the custom one before packaging. I have maven profile configured to be activated if following build command applied;
mvn clean install -DframeworkPacakging=XYZ
I am trying to use 'truezip-maven-plugin' to overwrite my custom spring configurations inside in 'abc.jar' present in 'target/aretfacts-id/WEB-INF/lib' but when maven-war-plugin finishes I loose my changes because war plugin takes the file from dependency definition. How can I solve this issue and what are my options?
P.S. Distributing configuration is not desirable as this setup would be used for Embedded Jetty Server running within Eclipse
to prevent inclusion of the original jar file, I would use go for approach suggested on: https://www.mail-archive.com/users#maven.apache.org/msg38537.html
Use <scope>provided</scope> for this dependency to keep it out of the
lib directory.
to include the repackaged one, I'd follow suggestion from: How to make Maven copy resource file into WEB-INF/lib directory?
Try changing the configuration of the maven war plugin to include a webResource:
<configuration>
<webResources>
<resource>
<directory>pathtorepackagedjar</directory>
<includes>
<include>**/abc.jar</include>
<includes>
<targetPath>WEB-INF/lib</targetPath>
</resource>
</webResources>
</configuration>
I am working on an application where we need to use java mail functionality. We have started using maven 3.x as out build tool.
Everything was working fine till Java Mail API has not been introduced. We are using Eclipse with M2Eclipse plugin but most of our deployment work is being done by maven Command line.
We have introduced following dependency in our pom.xml and I have verify that both mail.jar and activation.jar are in there respected folder structure.
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</dependency>
We tried the following command
> mvn clean
and then
>mvn tomcat:deploy
Though maven is showing that it has successfully deployed war on the tomcat but tomcat console showing that it is failing to deploy application and in other successful cases we are facing a strange issue, as we are using hibernate for persistance layer so on examing the folder structure it came out that the mapping file .hbm files are missing due to which Session factory is not creating and server is not able to startup.
Here is the snap shot of plugin entry
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1.1</version>
<configuration>
<packagingExcludes>WEB-INF/web.xml</packagingExcludes>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>tomcat-maven-plugin</artifactId>
<configuration>
<warFile>${project.build.directory}/${project.build.finalName}.war</warFile>
<url>http://localhost:8080/manager/html</url>
<server>localhost</server>
<path>/blood_donor</path>
</configuration>
</plugin>
From you procedure I see:
mvn clean - that deletes target directory with your build
mvn tomcat:deploy - should take the build (which was deleted with mvn clean) and deploy it on tomcat
There is no build phase. So use instead mvn clean package tomcat:deploy. If your application is already deployed in tomcat try mvn clean package tomcat:redeploy. For details check plugin documentation.
Which Tomcat version do you use?
According to http://repo1.maven.org/maven2/org/codehaus/mojo/tomcat-maven-plugin/ you use the version 1.1. In the plugin documentation you can find there that Tomcat 7 is not supported in this version. For that you must upgrade to version 2.0. See http://tomcat.apache.org/maven-plugin-2.0-SNAPSHOT/
Probably yo
I have a set of web apps that I manage that I am trying to move to maven.
/pom.xml // parent pom
webapp1/pom.xml // configured to point to parent
webapp2/pom.xml // peer of webapp1 and points to parent.
each of the webapps refers to the parent pom, and they both currently have a jetty maven plugin that works.
My question is how do I mount each of the webapps from the parent pom such that mvn jetty:run works in the parent directory?
edit to anwer: Pascal T
The issue is not so much that I'm getting an error when I try and run the command from the root pom, but that I'm not sure how to configure it.
for example the webapp1/pom.xml
looks like:
<project>
...
<plugins>
<plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
</plugin>
</plugins>
...
</project>
changing to this directory and typing mvn jetty:run works just fine and affords me the ability to hit: http://localhost:8080/webapp1.
However, what I would like would be to be in the parent of webapp1, and run all 'n' webapps from the parent directory. Thus having http://localhost:8080/webapp1, and http://localhost:8080/webapp2 available with one command line parameter.
btw, if the answer involved a tomcat plugin, that would be fine.
EDIT: I've totally edited my first answer now that I have a better understanding of the OP's expectations.
Check out Cargo, a thin wrapper that allows you to manipulate Java EE containers in a standard way.
Actually, there is a tutorial on Cargo's website that demonstrates how to use the Cargo Maven2 plugin to automatically start/stop a container (possibly deploying some deployables to it as it starts), which is what you're looking for from what I've understood.
I'm just not sure that doing this from the parent directory is feasible and if it's a requirement or if it would be ok to do it from another directory. I'll come back on this later. Lets first take a look at the Cargo Maven2 plugin setup.
In your case, you can start with the minimal configuration (that uses Jetty 5.x which is Cargo's default container):
[...]
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
</plugin>
</plugins>
</build>
[...]
If you want to use Jetty 6.x, you'll have to specify <containerId> and <type> in the <container> element:
[...]
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<container>
<containerId>jetty6x</containerId>
<type>embedded</type>
</container>
</configuration>
</plugin>
[...]
Then, add the modules you want to deploy by defining deployables explicitly inside the plugin configuration (refer to the Maven2 Plugin Reference Guide for the details of the configuration) :
<deployables>
<deployable>
<groupId>com.mycompany.myproject</groupId>
<artifactId>myproject-alpha</artifactId>
<type>war</type>
<properties>
<context>optional alpha root context</context>
</properties>
</deployable>
<deployable>
<groupId>com.mycompany.myproject</groupId>
<artifactId>myproject-beta</artifactId>
<type>war</type>
<properties>
<context>optional beta root context</context>
</properties>
</deployable>
[...]
</deployables>
With this, you should be able to start Jetty and have your webapps deployed on it with a simple (to run from the project containing the cargo plugin configuration):
$ mvn cargo:start
I'm just not sure that this can work with the parent pom (I wonder if this can lead to cyclic dependencies issues) and I didn't test it. But personally, I'd put all this stuff in the pom of a dedicated project, e.g. in a sibling project of your webapps, and not in the parent pom. I don't think it's a really a big deal and this is IMHO a better setup, especially if you plan to use cargo for integration testing.