change packaging value in pom during delivery to ibm RTC - maven-3

I wanted to know if we have a plugin or can we write a pre delivery script that will change the value of packaging in my pom file. I want it updated from jar to pom. Can a plugin help with this? Suggestion welcome.
I tried-and-tested with maven profiles but do not want to go that route.

When you deliver in RTC, all you are doing is making your file available to any repo workspace monitoring the common Stream.
If you need to make some change to a pom.xml (without using profiles), then it is simpler to publish (that is add, commit and deliver) as well a script which would:
copy the pom.xml
change it as you need
use it with a mvn -f pom-modified.xml
The point is, as mentioned in this thread:
There is no out of the box solution for enforcing any pre-deliver steps.
You can try and add an RTC extension, as described in "RTC: Build On Deliver Participant" by Jorge Díaz.

Related

Jenkins javadoc plugin doesn't generate documentation

I have installed Jenkins, create a project and configure it.
I run into a problem, Jenkins do everithing great except documentation generating.
Could anyone point me where I have done mistake, and how fix it?
Thank you.
------------------------ New information ----------
Console output:
I have renamed doc to javadoc directory, but it isn't help.
Here is screenshot of javadoc directory contents in console, it is clear that Jenkins plugin didn't generate documentation, but why?
It sounds like you are expecting the Jenkins plugin to produce the documentation. The Jenkins plugin merely copies files from the job's workspace folder to the build's archive area and provides a link to it. If your build steps don't produce Javadoc, then Jenkins won't be able to archive and provide a link to it.
Does your pom file include the maven-javadoc-plugin?
Are your build steps invoking a goal that includes Javadoc generation?
For example, "mvn jar" would compile Java and build the jar but not build the javadocs. Clearly you have executed a goal that executes the tests and provides a code coverage report, but that does not trigger the Javadoc goals either. You would need to make sure your build steps include a javadoc goal - i.e., mvn javadoc:javadoc. The standard goals can be found here: https://maven.apache.org/plugins/maven-javadoc-plugin/plugin-info.html .

in jenkins, how to copy artifacts from another server?

I have another project from which I need to copy artifacts.
However the problem I have is that it's from another server. Is there a way to do so with the copy artifact or I'll have to go through code?
You can accomplish by either publishing your artifact and using either file transfer or secure shell.
Here is info to read upon:
Jenkins Secure Shell Plugin
Jenkins FTP Plugin
The only other possibility is to modify the ant or maven project config file.
Here is a More Reference along the same lines.
I used a wget to fetch the file in the end, with fixed paths.
This link can help for someone not used with wget.
Using wget to recursively fetch a directory with arbitrary files in it
For a long time I use this python script to download artifacts from Jenkins. It takes advantage of the JSON API layer available to any Jenkins job. The format of that API call is:
http://_YOUR_BUILD_HOST_/job/_JOBNAME_/lastSuccessfulBuild/api/json
Beware script depends on PyCurl.
Publish over ssh plugin can also be used for copying the files/artifacts from one server (local/linux) to another server. It has retries option also in case there is network issue and no. of retires and timeout also can be configured.

How to config and run java project on Jenkins?

I'm very new with Jenkins. I have tried to run projects on Jenkins but all are fail. I don't know whether the configuration is wrong or something. I have read the instruction on the jenkins-ci.org but I didn't understand anything. Anyone can give me a demo with Java project? By the way, show me the Jenkins configuration. Thanks all!
First question, do you want to build a Maven project?
If the answer is yes, you can create a new job with this template "Build a maven project".
You just have to configure your SCM tool (Git, SVN, ...) and when you want to pool your code (cron tab).
Next, in the build section, you have to declare your Maven goals (clean install for example) and the pom.xml file location (if the pom.xml file is not in the root folder).
That's all.

Versioning modules independently in multi project environement and zipping all dependencies

I am new to ant and Ivy. We are using Jenkins for CI with ant for builds, Ivy for dependency manger. We have several modules/projects which generate jars and wars, which can be independently versioned and released (not all modules will be released at the same time), so, need to maintain version number separately for each module. We want to use the version format A.B.C.D (ex: 1.2.1.2). I found I can use a property file to enter a version number and use ant BuildNumber task to increment the number for our nightly builds. So, once all the features are in and tested we move the last successful nightly build as new released version but we want to change the version number without rebuilding it. For example last successful build was 1.2.1.20 and it was tested thoroughly and has all the feature, we have to make this build from 1.2.1.20 to 1.3.0.0 without rebuilding the modules. How can I do that using ant? And also I need to publish them to my shared repository with the version 1.3.0.0. How do I do that?
Also, we want to create a zip file for each module with all dependency files along with the module's jar file for delivery. Is there any ivy or ant tasks that can help to create this?
I think you've asked two questions...
Generally, every build I create is releasable so I'm always incrementing the last digit in my release number scheme. For controlling the version number I prefer to use the ivy buildnumber task, which increments based on what has been previously pushed to your repository (very useful).
Creating a zip package is quite straight forward. Just alter your ivy file to publish more than one artifact.

purpose of signing maven artifacts with gpg

I understand that this can be done at release using the maven-gpg-plugin. However, I am not developing open source software. Do I still need to sign my own artifacts? What is the point of this? I thought that once my sources were compiled into a JAR, they were secure anyway? Thanks!
If you compile your sources into a jar is ok. But a jar a is simply zip file which can be simply unpacked by unzip/jar after that you can modify the contents of a jar which means you can simply change the contents and repackage that into a jar. So to say it clear: It's safe is simply wrong.
If you create your artifacts via maven you will deploy your artifacts to a repository manager and during the release process a SHA1 sum is created ...which can be checked during the usage of dependencies (download). The default configuration just prints out a warning if the checksum in the repository is not the same as calculated over the jar archive. You can if you like change the configuration to break the build if the checksum is wrong.
The checksum is only to identify modifications of artifacts which is also not 100% safe cause it can happen that you have a man-in-the-middle-attack which might not only modifiy the contents of the jar and also the checksum.
On the other hand the signing of an artifact is used to identify who has created that artifact. In some environments it does make sense to sign artifacts during the release process.
Update To prevent man-in-the-middle-attach the Maven central repository used for a long time https instead of http.

Resources