Problem
With Gradle the project name is derived from the project's directory name. However, in Jenkins the project's directory name is derived from the Jenkins job name.
There are a few steps in the build lifecycle that use the
project.name
, such as the jar task. If our Jenkins job was "myProject_build" this would result in a jar named myProject_build-1.0.jar
.Solution
With a single project the solution is to add a
settings.gradle
and set the (root) project name there (rootProject.name = "..."
).
With a multi-project build you may wish to override the sub-project name:
In this recipe we will see how easy it is to call the Weblogic tool "wldeploy" from Gradle.
Getting ready
The deployment depends on having a copy of the wlfullclient.jar available to the build scripts. There are plenty of tutorials online on how to create this, so I wont cover that here.
How to do it ...
- Create our build file.
- Create our Weblogic instance configurations.
How it works ...
I wont get into the configuration elements of this project. Its covered in great detail here. The important thing to take from this is we are tokenizing our build scripts making them reusable.
The deployToWLS task is where the magic happens. Here we define the ant task using the name, classname and classpath. Next we specify a directory with our deployables; I've used the "build/libs" directory as that's where my war files are packaged to. Next, through the powers of the eachFile closure we get the filename and trim the extension, we then deploy each file in that directory.
I've been using this for a few months now and whilst my usage isn't massive, I do tend to use the command line about once a day.
Here's some of my most used tasks:
setEnv
Here's some of my most used tasks:
setEnv
I wrote an environment configuration script in a previous post that I want to be called when I open ConEmu. The picture above shows how.
Git Bash
My VCS of choice is Git and it comes with Git Bash to allow me to call some of my favourite Git commands. Here's how that's integrated into ConEmu.
setWLSEnv
Finally, I use Weblogic for a lot of my Java EE container needs. To set the system path and classpath Weblogic comes with a setWLSEnv script. In a similar way to calling my own, here I simply call the setWLSEnv script provided by Weblogic.
Subscribe to:
Posts (Atom)