Tomcat war with version number deployed by Maven plugin - tomcat7

i use maven3 to deploy to tomcat7, and in the process, it builds the war with a version number, and when the maven plugin deploys it, the version number is no longer part of the war, and the path i set works properly (all of this works as expected, no problems).
the plugin i'm using for the deploy is groupId "org.codehaus.mojo"
My question is how this happens, because i need to replicate this process when i manually deploy a war with a version number.
I want the version number taken out, and i want to set a path, other that the war name.
Looking for help to do this.

use element in the pom.
And move to new version of this plugin which is now located at Apache http://tomcat.apache.org/maven-plugin.html

I found solution and checked it into https://github.com/vipup/java-maven-war-example . Thanks a lot of advice from SO_Answer ..
In short : the deployment_URL should contain the version of deploy-WAR. Then Tomcat process it always correctly. I added in the project even possibilities to set version as command - line - parameters.
So, just try:
# mvn tomcat:redeploy -DtheBN4tomcat=HALILUJA

Related

Maven - Jenkins issue

There are couple of issues I am facing in Jenkins integration . I run the scripts from local Eclipse and it works perfectly fine with Selenium Grid. I am trying to setup this whole thing in Jenkins and facing the following issues
1. cannot find symbol - Seeing this issue in Jenkins and searched about this in Stack Overflow . Verified the JDK version and my pom.xml version matches with the one installed in Jenkins.
2.I have three packages- One has the framework , second one has the main method and the third one has the code related to the application i am testing. I am converting my framework to a jar and uploading the entire thing to GIT . When i build the project jar using Maven install , its not including the framework jar which is causing the issue . I tried a lot of things suggested in Stack Overflow and it did not work. I am quite new to this kind of Maven stuff
3. I am not even able to run the scripts with the help of the runnable jar in my local because of issue# 2
Some of these have already been posted but i tried out those things and did not work for me or I might be missing something
In Maven you have a file called settings.xml which contains URL of the location from where you want to fetch all your dependencies like here JAR files in your case from GIT. It works from your eclipse because maven looks for dependencies in your .m2 folder which are there when you run it from eclipse. But, in order to build it from anywhere else you need to specify that URL in maven's settings.xml

Secondary Jar version don't sync up when deploying

I'm using gradle artifactory plugin to deploy my library to oss-snapshot-local.
The first deploy works as intended and the filenames are correct:
eg.
skrypton-api-1.0.0-20171014.053125-1-sources.jar
skrypton-api-1.0.0-20171014.053125-1.jar
But on the second deploy, the sources jar is not uploaded despite the plugin saying it has deployed it. I end up with only
skrypton-api-1.0.0-20171014.053349-2.jar
Deploying for the third time,
skrypton-api-1.0.0-20171014.053349-2-sources.jar shows up. But not third source jar. Only skrypton-api-1.0.0-20171014.054252-3.jar
This is what it looks like in general after 3 deploys
The source jar version seems to be stuck at (deploy number - 1) after the first deployment. Tried it with a javadoc jar and it also doesn't work properly.
This is the build script in question.

Grails Release Plugin Maven Deployment doesn't update <latest> tag in maven-metadata.xml consistently

Background
I have two Grails applications, both running Grails 2.3.6 with the release plugin installed (build ":release:3.0.1").
I have a jenkins CI server setup to automatically pull the projects from source control and deploy the war to artifactory. From there, it can be automatically deployed to our tomcat server by a script.
For one application, the maven-metadata.xml file generated by Artifactory contains a <latest> tag, which specifies which of the versions of my application is the latest one.
Problem
My problem is, the other application doesn't have a <latest> tag, even though it's using the exact same command to deploy to our Artifactory repository-- grails maven-deploy. The BuildConfig.groovy files are basically identical.
This is a problem because I need that <latest> information to be available for my deployment script.
From what I've read around the web, the maven-metadata.xml file is generated by maven 2 only when the -DupdateReleaseInfo=true flag is set. However, I can't see any place that the working application is passing this flag to maven during the build.
I've tried the fix suggested on this thread-- namely,
Making sure that deploying user has "annotate" permission
Maven Snapshot Version Behavior = "Deployer"
But my second application still doesn't get a <latest> tag added to its maven-metadata.xml.
So, I figured out that I can easily just pass -DupdateReleaseInfo=true to the grails maven-deploy command as an additional argument, and that forces maven to update the <latest> tag in maven-metadata.xml. I'm not sure why it is doing it sometimes and not others, but at least it works!

How do I deploy a maven created webapp to tomcat

So I was following http://www.mkyong.com/jsf2/jsf-2-0-hello-world-example/ for a simple tutorial on how to use maven and jsf. I created a maven project by running mvn archetype:generate -Dfilter=org.apache:maven-archetype-webapp in my command prompt. Then I continued with the tutorial, I wound up creating all necessary files, but then when I got to the end, I realized I did have a server created. So I created one real quick, but when it came to the point of adding files to the server (from the add or remove dialog box), no projects or files showed up. I am not on my computer where the project is located so I can't copy/paste the .pom file in, but it looks practically exactly like the pom in the tutorial (only difference is groupId, artifact, ect.) No additional plugins, dependencies, or configs.
Do you want to deploy the webapp within Eclipse to Tomcat? Or as some sort of automatic/continuous deployment?
Within Eclipse you often need to add the Dynamic Web project and JSF facets to your project so Eclipse recognizes the project as deployment capable. If you are using m2eclipse make sure to install the m2eclipse wtp add on so this is done automatically.
If you want to add auto-deployment to the pom.xml I recommend using the maven cargo plugin: http://cargo.codehaus.org/Maven2+plugin - it supports the major containers.
For tomcat you need to modify the tomcat-users.xml to allow auto-deployment and leave the tomcat-manager application in place. If you have startet tomcat and pointing your browser to http://localhost:8080/manager/html/list it should either tell you to login or what to add to that file.
The configured user is then used in the configuration to deploy the war file via the tomcat-manager using the mvn cargo:deploy goal. The configuration has to be added to the pom.xml using war as packaging, not to the parent-pom.xml

Hot deploy war maven project in embedded tomcat

I have maven war project.
I know inplace. it deploys to a given server. But i want to deploy on embedded tomcat and dont want to restart everytime. just say
for first time run deploy
Then change some java class and say redeploy. All in embedded tomcat.
Is this possible ?
Could the Tomcat Maven Plugin help with this?
You can use it by using the command tomcat:run
This page describes how to set up your POM/settings to make calling the plugin easier (using a prefix vs having to use full groupId/artifactId of plugin on the command line).
Maybe you can have a look at the executable war/jar feature see http://tomcat.apache.org/maven-plugin-2/executable-war-jar.html
So that will produce a simple jar which contains tomcat classes. You will be able to simply run: java -jar pathtofile.jar.

Resources