hot swap of view files with cargo macen plugin on tomcat 7

145 views
Skip to first unread message

Stillkgb

unread,
Jul 31, 2020, 6:04:19 AM7/31/20
to Codehaus Cargo
Hello!

Can you please answer is it possible to perform hot swap of view files (xhtml, css etc) with cargo maven plugin?
I am starting my java/jsf app on tomcat 7 with cargo maven plugin. 
It runs great but when I change xhtml or css file in my working folders (not compiled one) there are no changes in the browser.

So is it possible to do so and I make some mistakes in pom.xml or it is not possible at all?

Thank you!

S. Ali Tokmen

unread,
Aug 1, 2020, 5:46:36 PM8/1/20
to codehau...@googlegroups.com

Hello :-)

It looks like you're trying to perform in place development, perhaps you can use the following sample for inspiration: https://github.com/codehaus-cargo/cargo/tree/master/extensions/maven2/samples/inPlaceDevelopment-test

Regards

S. Ali Tokmen
http://ali.tokmen.com/
http://contact.ali.tokmen.com/
--
You received this message because you are subscribed to the Google Groups "Codehaus Cargo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codehaus-carg...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codehaus-cargo/5e160b34-dd1a-413c-b868-ffb2f1715532o%40googlegroups.com.

Stillkgb

unread,
Aug 3, 2020, 4:36:34 AM8/3/20
to Codehaus Cargo
Hi, Ali
Thank you!
I'll try it
Thanks! =)
Kind regards

воскресенье, 2 августа 2020 г., 0:46:36 UTC+3 пользователь S. Ali Tokmen написал:

Hello :-)

It looks like you're trying to perform in place development, perhaps you can use the following sample for inspiration: https://github.com/codehaus-cargo/cargo/tree/master/extensions/maven2/samples/inPlaceDevelopment-test

Regards

S. Ali Tokmen
http://ali.tokmen.com/
http://contact.ali.tokmen.com/
On 31.07.20 12:04, Stillkgb wrote:
Hello!

Can you please answer is it possible to perform hot swap of view files (xhtml, css etc) with cargo maven plugin?
I am starting my java/jsf app on tomcat 7 with cargo maven plugin. 
It runs great but when I change xhtml or css file in my working folders (not compiled one) there are no changes in the browser.

So is it possible to do so and I make some mistakes in pom.xml or it is not possible at all?

Thank you!
--
You received this message because you are subscribed to the Google Groups "Codehaus Cargo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codehau...@googlegroups.com.

Stillkgb

unread,
Aug 5, 2020, 5:35:43 AM8/5/20
to codehau...@googlegroups.com
Hi , Ali!

Sorry but can't quite understand how it works(
Should I just add this dependency to my pom.xml and I'll be able to modify my view files in working directories (src/java...) and changes will be immediately displayed in the browser?
<dependency>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-sample-maven2-inPlaceDevelopment-test</artifactId>
<version>1.7.15</version>
<type>war</type>
</dependency>
my full pom.xml and it doesn't work( no changes reflected in browser
<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.epam.training</groupId>
<artifactId>myserv</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>

<name>myserv Maven Webapp</name>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.18</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.1.2</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>1.1.2</version>
</dependency>

<dependency>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-sample-java</artifactId>
<version>1.7.12</version>
</dependency>

<dependency>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-sample-maven2-inPlaceDevelopment-test</artifactId>
<version>1.7.15</version>
<type>war</type>
</dependency>
</dependencies>

<build>
<finalName>myserv</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.7.15</version>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>tomcat7</id>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<configuration>
<container>
<containerId>tomcat7x</containerId>
<artifactInstaller>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat</artifactId>
<version>7.0.105</version>
</artifactInstaller>
</container>
<configuration>
<properties>
<cargo.servlet.users>
andrey.smirnov:123:user|andrey.zvorygin:123:user|maxim.nabatov:123:user
</cargo.servlet.users>
<cargo.servlet.port>8443</cargo.servlet.port>
<cargo.tomcat.ajp.port>8444</cargo.tomcat.ajp.port>
</properties>
<type>standalone</type>
</configuration>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
</profiles>
</project>
Thank you
Kind regards

вс, 2 авг. 2020 г. в 00:46, S. Ali Tokmen <nos...@alishomepage.com>:

S. Ali Tokmen

unread,
Aug 5, 2020, 6:57:39 AM8/5/20
to codehau...@googlegroups.com

Hello

I see - Actually, that is not a dependency, but rather an example, in other words you should use https://github.com/codehaus-cargo/cargo/blob/master/extensions/maven2/samples/inPlaceDevelopment-test/pom.xml for inspiration.

From what I see, the key is to use the <location>${expandedWebapp.directory}</location> in the <deployable> definition, so that what is deployed is the expanded WAR folder and hence your CSS and other modifications will (hopefully) be picked up by the container quickly.

On the other hand, having Java changes directly available in the container will be more complex: you need to somehow auto-compile things real time.

Stillkgb

unread,
Aug 5, 2020, 8:00:20 AM8/5/20
to Codehaus Cargo
Hello
thank you, I think im starting getting it 
But how it will detect changes in my view files?
Does it perform some sort of scanning my folders?

Thanks

kind regards

среда, 5 августа 2020 г., 13:57:39 UTC+3 пользователь S. Ali Tokmen написал:
To unsubscribe from this group and stop receiving emails from it, send an email to codehau...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Codehaus Cargo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codehau...@googlegroups.com.
--
You received this message because you are subscribed to the Google Groups "Codehaus Cargo" group.
To unsubscribe from this group and stop receiving emails from it, send an email to codehau...@googlegroups.com.

S. Ali Tokmen

unread,
Aug 5, 2020, 9:50:05 AM8/5/20
to codehau...@googlegroups.com

Hello

The location attribute is the directory to use when deploying the WAR, which implies that that directory is the one served by the container. There is no copying around.

To unsubscribe from this group and stop receiving emails from it, send an email to codehaus-carg...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codehaus-cargo/2f618adb-8070-46bd-b168-21dbcf41020bo%40googlegroups.com.

Stillkgb

unread,
Aug 5, 2020, 10:42:22 AM8/5/20
to Codehaus Cargo
Thanks
So to see changes in browser I'll have to change files that are in the container? or container somehow reacts to changes in working directories?
Sorry for stupid questions(
Kind regards

среда, 5 августа 2020 г., 16:50:05 UTC+3 пользователь S. Ali Tokmen написал:

S. Ali Tokmen

unread,
Aug 5, 2020, 2:43:21 PM8/5/20
to codehau...@googlegroups.com

Hello

These are key questions :-)

To see the changes you'll need to ensure the files in the directory set as <location> are updated.

Does this help?

To unsubscribe from this group and stop receiving emails from it, send an email to codehaus-carg...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codehaus-cargo/507b8b4c-b769-4d58-9bb0-8236ead29c4ao%40googlegroups.com.

Stillkgb

unread,
Aug 6, 2020, 2:23:54 AM8/6/20
to Codehaus Cargo
Hello 
As I understood to see updates in browser I'll have to change files in expandedWeb directory(that will be in <location>)? and these are files from unpacked war?
or may I make something like to include html/css file's destination folder to <location>, but also I need my compiled java classes to be included to <location> attribute so it would also be in container.
so I need to specify 2 different locations in <deployable> smth like this  
<deployable>
  <groupId>com.epam.training</groupId>
<artifactId>myserv</artifactId>
  <type>war</type>
<location>${project.build.directory}/classes</location>
<location>${project.basedir}/src/main/webapp</location>
</deployable>

Thanks
kind regards

среда, 5 августа 2020 г., 21:43:21 UTC+3 пользователь S. Ali Tokmen написал:

S. Ali Tokmen

unread,
Aug 8, 2020, 5:46:40 AM8/8/20
to codehau...@googlegroups.com

Hello

You are getting there - I'm unsure how your application is built, but that would be kind of what to do.

You can only have one <location>, though; so please check in your case where the files are getting generated and use that.

To unsubscribe from this group and stop receiving emails from it, send an email to codehaus-carg...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/codehaus-cargo/b203cf23-35f9-4617-8b9f-240bd52f5b99o%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages