JHipster executable WAR using dev profile instead of prod - spring-boot

I package a WAR using mvnw -Pprod package. According to JHipster website:
Please note that this WAR file uses the profile we selected when building it. As it was built using the prod file in the previous section, it will therefore run with the prod profile.
And also:
When you run your production application from a WAR file, the default is to use the same profile(s) as used during packaging. If you want to override this, you can explicitly provide an alternative in VM argument
However, when I run my WAR without --spring.profiles.active=prod, it runs under the dev profile.
What gives?

JHipster web site documents the most recent version. In your case, your version is well behind latest so it does not longer match but you can find the archived documentation for your exact version at https://jhipster.github.io/documentation-archive/

Related

How do I set up Spring and Maven environment for working offline?

I need to set up Spring and Maven for working offline. I am working with Spring Tool Suite.What environment variables do I need to configure besides M2 env var? When I try to add dependencies in pom.xml, and type springframework, nothing comes up in the search bar. I get "Core exception Could not calculate build plan Plugin org.apache.maven.plugins:m. I understand STS uses web services to locate the jars, so how do I configure Spring and Maven to work offline? Thank you.
Maven uses central repositoty to update dependencies via internet if you want run it offline you need to configure you local repository.See Setting local Maven repository
This is something that you will find very difficult or near impossible unless you somehow get all the relevant jars from spring and place them in your .m2 repo directory.
Your question has been asked a number of times on here ...
Have a look through these 2 questions which I assume is exactly what you have encountered.
Question 1
Question 2
Also one last note ...
After you setup your variables did you restart your PC I know sometimes I forget to do this when updating environment variables.
Before you go offline run the following:
mvn dependency:go-offline
That will download all your dependencies and plugins that you need to build your project into ~/.m2/repository.
Once you've run that you can now build your project offline using the '-o' flag:
mvn install -o
It's also possible to configure the offline mode globally by setting the offline property in the ~/.m2/settings.xml file:
true

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!

Maven JBOSS application deployment

I followed this tutorial http://www.mastertheboss.com/jboss-maven/jboss-maven-example-building-a-java-ee-6-application/ in order to have a simple web application to better understand Java EE and JBOSS. I set up the example project (by archetype) and compiled it.
However, I am stuck after running mvn compile. I want to deploy my application as a war file to my JBOSS webroot directory (in my case /usr/share/jboss-as/standalone/deployments/).
I think mvn package and mvn install must be executed. Where can I specify that I want a war file and that it should be copied to my deployment location on JBOSS?
Obviously, I can use the jboss maven plugin http://docs.jboss.org/jbossas/7/plugins/maven/latest/, which is addressed via console
jboss-as:deploy
Configuration is read from the POM file.

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

Tomcat war with version number deployed by Maven plugin

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

Resources