Automatic Jenkins deployment in websphere - java

i need to deploy ear/war file from svn to websphere using jenkins job ?
i have different environment. By using svn tag name and environment details i need to do deploy in different environment websphere.
can any one suggest me how will i achieve this ?

This might help you with the second part of your question. This is a plugin to deploy jenkins artifacts on
https://wiki.jenkins-ci.org/display/JENKINS/WebSphere+Deployer+Plugin

I have tried to do this by jenkins plugin, but it works bad. It can not support multiply node and the ssl management is also boring.
So i sujest you use the ant shell in the target machine for deployment.

Related

hotdeploy / hotswap classes using wildfly maven docker intellij

I have a current setup of intellij 2016 which compiles my java files on the fly. Due to some configuration in intellij it is possible to propagate any changes directly to tomcat. This way I don't have to manually build a new application and deploy it to tomcat which increases user productivity.
We want to remove tomcat and start using wildfly10 but also keep the hotdeploy functionality. On top of that the wildfly server will be hosted in a docker container.
So what I did is that I mounted the wildfly/standalone/deployment/myapp.war using docker to my host directory myapp/target/myapp.war. In addition I configured a jboss remote server configuration with remote stating set to same file system and let maven build an exploded war. This way if a maven build is performed, the contents of the target/myapp.war directory is directly available in my docker container. When I run the container and perform a new maven package, I do see that wildfly states that the new changes are found and redeploying has succeeded. Unfortunately this only goes well once or two times in a row.
So coming from the tomcat hotdeploy where no maven build was involved and any changes where directly available in tomcat, I'm wondering if the same can be achieved with the setup: intellij, maven, wildfly and docker. So if a change of a java file in intellij is compiled and pushed to wildfly without redeploying or maven build?
Wild-fly - eclipse supports 100 % Hot Code replacement
you have to start web-app in debugging mode .
For every change in java code just do a maven install and refresh
the target .
Limitations :
you can only replace statements in method .
you are not allowed to change whole class and new methods .

Jenkins building for different environments

I currently have a Jenkins instance installed on a Development box. This builds fine and deploys to our development environment without any issues.
During the build process my project makes use of a single properties file containing details such as a database connection URL (Details such as these will obviously vary depending on the environment I'm pointing to).
What I would like to know is what is the best way to configure my project so that when I want to release to Production the WAR file built by Jenkins contains the Production properties instead of Development?
(Note I am also using Maven in my project).
I know 3 options:
We have used maven.-profiles for that in the past, but they have the disadvantage, that the release-plugin of maven doesn't work with profiles, so we had to change the versions manually and were unable to deploy the artifacts in a remote repository like nexus.
Another Option is mavens assembly-plugin. That can be used together with the release-plugin, as far as I know.
We decided to write a simple tool that changes the war-files after the maven-build process. It runs in a seperate Jenkins-Job. The Idea is, that building and configuring are two seperate steps. The Artifacts comming out of maven are always in a default-configuration. And if we need the configuration for the production release we start a jenkins job that does the configuration of the war-files.
You can create different maven profiles, like dev, prod, then in the profile setting, use/filter the corresponding resource files like .../(dev|test|prod)/project.properties And in Jenkins, when you build for different platform, build with -Pdev or -Pprod to get the war for the right target.
You may want to check maven profile, maven resource filtering for detailed configuration.
something not related, connect Database via jndi if possible.

Managing Maven project in Eclipse with git repository

we recently migrated to Maven Build manager & git hub repository for our Java web-app. Also i switched to eclipse as eclipse has good set of plugins.
As a new bie, i am simply running mvn clean package from terminal at the code root directory. And then moving the compiled code i.e., /target/SNAPSHOT/* to tomcat/webapps/ROOT location.
And then starting Tomcat7 server. The process is time taking especially when i do code changes in Java & configuration .xml files.
I want to do it completely in IDE environment as i did earlier in Netbeans, update code -> build and run in debug mode, -> do code changes and then commit.
Heard of egit & m2e in eclipse for maven & github integration, but not sure how to use it.
Please walk me through the steps required in doing so. I am completely new to eclipse.
--
Thanks
You might want to consider using maven-jetty-plugin http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin for running the webapp. You will not need to copy over stuff to tomcat. After configuring this plugin, you can simply run your application by doing mvn jetty:run
I generally do not like running webapps inside Eclipse. It's a personal prefrence, but it is always nice to have an IDE neutral way of building and running your applications. If you have m2e things should work simply fine. I have seen maven-jetty-plugin having hot pluggability where if you changed your web.xml, jetty would reload your application.
We use Git for version control and Maven for dependency management and build automation. Once your project has successfully imported into Eclipse and recognized as a valid java web project, you don't need either Git or Maven in order to build/run it inside IDE. Just creat a server using you existing tomcat installation, add the project to server, then select Run as > Run on Server.
The Complete Guide:
Creating a server
Adding projects to a server
Starting a server
For more details, check out Testing and publishing on your server.

Deploy Java EE project to WebSphere 7 WITHOUT Eclipse

I am getting tired of all the bugs in eclipse and m2eclipse, and would like to build with maven using the command prompt, plus afterwards start the server, and deploy the application to the server and publish it using the command prompt. Normally I do that within eclipse servers tab.
If I make a change to the code, then I should just rebuild with maven and republish.
I am aware that you can deploy an EAR in Wepshere admin web console, but it is not ear I am thinking of, at least I don't think so. I want to be able for example, once application is deployed, jRebel should be able to reload the clases in the jvm, but I believe the ear file is standalone so that wouldn't work.
So,
How can I start the server from the command prompt, plus deploy a project and publish it ?
Thanks!
You can automate the build so that it deploys the app as well, at least with Maven. Have a look at this post: Maven 2 and WebSphere:
WebSphere has (had?) a Rapid Deploy feature that you can use for "hot" deployments. Essentially it fired up a headless Eclipse for this, but it was much faster than a full EAR build and just as dynamic as going through WTP.
At the time, we had an Ant task that we used to copy the files over to the WRD directory. I'm not sure how that would work with Maven, but I imagine one could rig up something.

Which Maven GlassFish plugin to use?

I've been trying to integrate deploying java .war's in GlassFish V3 through Maven. While I have found a few plugins, none of them look to be very active:
Maven Glassfish Plugin
Eskato's Wordpress Blog on Maven
And I got the most information out of Eskato's Blog, it was written March 2008, so I don't know what the state of GlassFish Maven integration is, nor can I find a suitable plugin to work with. With the Maven GlassFish Plugin I have had some success, but it still doesn't work entirely well for all goals it says it supports, which makes some of the commands ineffective.
Has anyone else been able to integrate Glassfish V3 and Maven successfully? If so, what resources did you use to get it done?
Update: CARGO-491 has been fixed and I've updated my answer accordingly. To summarize, there are now basically three options:
Maven GlassFish Plugin
A first option would be to use the Maven GlassFish Plugin. This plugin allows to interact with a local or remote GlassFish install and the management of Glassfish domains and component deployments from within the Maven build lifecycle.
Maven Embedded GlassFish Plugin
The second option would be to use the Maven Embedded Glassfish Plugin. As stated by its name, this plugin doesn't rely on an existing install but uses an embedded GlassFish, running in the same JVM as the plugin. This plugin is extremely nice if you want to keep your build portable (anybody can get your POM and run a build involving GlassFish without having it installed) with almost the same features as a normal GlassFish install, except clustering of course (you can use a preconfigured domain.xml if you want). See Testing with the GlassFish Maven plugin and JavaDB Embedded for an example.
Maven Cargo Plugin
The work initiated by Kohsuke Kawagushi as been finally integrated in Cargo and, starting with Cargo 1.0.1, GlassFish 3.x is now supported. Using the Maven Cargo plugin is thus a third option. This would be interesting for builds that want to interact with containers in an agnostic way. But I'm not sure Cargo allows all the flexibility of the GlassFish specific plugin(s) (e.g. deployment of JMS resources, etc).
maven-glassfish-plugin and maven-embedded-glassfish-plugin both have their pros and cons. The main difference is that the latter works with an Embedded Glassfish instance, as indicated by its name, i.e. the server is running in the same VM as the plugin.
So you cannot use maven-embedded-glassfish-plugin to deploy your WAR to a standalone Glassfish server, you need maven-glassfish-plugin to do that.
The main problem I had with the maven-glassfish-plugin is the fact that its interaction with the Glassfish server is stateful - I could not find a way to use it such that my WAR would get deployed to the server in any case, no matter whether the previous build succeeded or not.
glassfish:deploy does not work if the WAR is deployed already. glassfish:redeploy does not work if the WAR is not deployed. And Maven has no if-else logic...
I've blogged about how to configure Maven Embedded GlassFish plugin to work correctly with GlassFish 4.0 until there's a new release of that plugin.
https://blogs.oracle.com/brunoborges/entry/glassfish_4_beta_and_maven
Also, it is possible to configure a datasource in the glassfish-resources.xml and have it working correctly.
https://blogs.oracle.com/brunoborges/entry/configure_datasources_for_maven_embedded
These are useful tips to anyone that want to run Java EE 7 projects with Maven and GlassFish 4
You can use this one :
http://www.hascode.com/2011/09/java-ee-6-development-using-the-maven-embedded-glassfish-plugin/
https://github.com/andrzejsliwa/glassfish-maven-plugin/wiki
http://cargo.codehaus.org/Maven2+plugin
I use the glassfish plugin on maven-glassfish-plugin.dev.java.net and did some code changes to support v3 now. I requested committer status and wait for acknowledgement. Hopefully I can commit my changes.

Categories

Resources