I have been reading about building rpm from war files & use them for installation. As part of it I downloaded sample war and trying to create rpm. My tomcat version is 7.0. I ran rpmdev-setuptree which creates the directory hierarchy needed for rpm build. All I intend to do by installing the rpm is : stop tomcat, delete the sample.war & sample folder from webapps, copy new war to webapps & start tomcat. Can I accomplish it? or rather I would like to know, is this the correct way of using rpm build from the war? Or am I missing something?
If you are using maven you can use the RPM maven plugin
Related
I'm learning Maven with eclipse and a liitle bit confused on how to deployed it on a remote server.
Before using Maven I created a web project and exported it as ear file and copied to the server's deployment folder. With Maven do I follow the same step? Do I need to install maven at wildfly server by modify the configuration xml? Thx.
Use maven only to produce artifacts(jar, war, ear). I was in the same position a couple of years back and found a useful link to build a project as an ear with maven.
For the remaining tasks, I coded Shell script to move the artifact from /target directory to wildfly10 \standalone\deployments.
It could also be achieved without any script using symbolic links.Just cd to your \standalone\deployments directory and:
ln -s [ABSOULUTE-PATH-TO-YOUR-WAR/EAR-FILE] [NAME-OF-EAR]
That's it. If you are more interested in symbolic links you may read here
Does anybody know a gradle 'hot deployment' plugin (or middleware as shell script) which is coping files from source folder directly into project folder at tomcat's webapps directory (not embedded server like gretty or gradle tomcat plugin; version7, environment independent)?
At the end I want to realize a smart dev workflow to (re-, un-) deploy a java web application during code crafting. I'm searching for something like grunt watch tasks.
Scenario: Java web application with self contained, executable jar file at WEB-INF/lib folder.
register watcher tasks on top on gradle task
java source is changed
tomcat stopped
remove jar file at WEB-INF/lib folder
deploy jar file
copy jar into WEB-INF/lib folder
(delete all log files)
start tomcat
Restart tomcat is not needed if static sources are changed (e.g. JSP, JS, ect.).
Solution
I thought about our working practices at the office. My colleagues and I, we program on Windows machines and we use a key map configuration in IDEA to start and stop our local installed Tomcat.
The easiest way for me is to define a user related CATALINA_HOME system environment variable which references the path to Tomcat server.
CATALINA_HOME = C:\Program Files\apache-tomcat-7.0.56
I define a deploy task which copy compiled war file into webapps folder ((re)start Tomcat manually via IEDA).
task deploy(type: Copy) {
def WEBAPPS_HOME = System.getenv()['CATALINA_HOME'] + '/webapps'
from 'build/libs/app.war' into WEBAPPS_HOME
dependsOn war
}
Nobody need to change Tomcat path inside build.gradle file or there is no additional user.config file which is ignored by git.
But I don't like manual Tomcat handling and it is unusual to work with environment variables on Mac's.
So, I decide to search an embedded Tomcat server as Gradle cargo plugin for local development. It is recommanded from Benjamin Muschko (Gradleware Engineer) at How to use local tomcat?... and he describe the differences between Cargo or Tomcat plugin....
Setup of this plugin is quite easy. I don't need to explain.
Nobody need to install there own Tomcat and everybody work with same version server.
For our nigthly build I use the power of Gradle wrapper as Jenkins task configuration.
I execute a wintods batch command.
cd "%WORKSPACE%\app"
gradlew.bat clean build
I use Jenkins to manage deployments for our applications.
There are a number of plugins which help with such tasks along with having the ability to write your own scripts.
Jenkins is highly configurable so you are able to adapt it to your own needs.
Jenkins URL
I have a war project. A few static HTMLs need to be copied into the webapp folder before building war. To achieve this, added maven-resources-plugin copy-resources goal (process-resources phase). This is working fine as I can see the built war includes the copied files.
When I run this war using mvn tomcat7:run the path is not recognised (404).
However, when I deploy the war into a tomcat server, the path is accessible.
Any thoughts? Looks like tomcat7 plugin does not use the built war but accesses the files directly from src folder. Is this a bug or just how tomcat7 plugin works?
Have you tried using the additionalClasspathDirs param? from https://tomcat.apache.org/maven-plugin-2.2/tomcat7-maven-plugin/run-mojo.html
additionalClasspathDirs:
Additional optional directories to add to the embedded tomcat classpath.
Type: java.util.List
Since: 2.0
Required: No
if that doesn't work you can use maven-antrun-plugin see how to copy a file to tomcat webapp folder using maven?
When i make the war i see the XCV.Jar, but I add the project on Tomcat (IDE eclipse), and when I deploy it, I have all jars except XCV.Jar (This jar is the parent of the project I deployed).
When you deploy to Tomcat from Eclipse it often fails to clean up the work directory directory. Try to clean $TOMCAT_HOME/work/Catalina// and the web apps directory then try redeploying.
If you are running tomcat inside eclipse you're asking for trouble. Its often better to build and validate the .war independently(with ant or maven) then deploy manually or with a script.
I'm using SubClipse for Eclipse for my project.
And in this project I've added my own package "com.mytestpkg.www"
I then use TortoiseSVN to deploy my project on the TomCat server where the project is running, because i the easily can update the site with "SVN Update".
But using this method I always have to manually update my package by copying it from my Eclipse workspace build path to the WEB-INF folder classes/com/mytestpkg/www.
Is there a way to make Subclipse/SVN update this file directly with the other files?
Why don't you do this a more conventional way; e.g.
get Eclipse to create and deploy a WAR file
use Ant or Maven to build the WAR file and deploy it by hand. (The Maven way of building WAR files is really slick!)
Doing a checkout into a Tomcat server's webapps directory is ... weird. And you've got the problem of stopping the world seeing the .svn directories.