Can I disable a maven plugin from command line? - maven-3

Is there a way to execute a maven build from command line, but disable a configured plugin without changing the pom file?
The reason for that is, that we have a number of given maven projects, which we develop together with a customer. In these projects a rpm plugin is configured, which does not run in our Windows environment. So I'd need a way to control the build in a way that it just ignores this build step without having to change the pom file (like using profiles, which I would use, if I were able to change it). Unfortunately the plugin does not have a skip property.
The only other idea I had was faking the rpm command which is called in the plugin, but this didn't work.

Related

Continuous Integration with hybrid mobile app

I have a problem. I need to build a job in my Jenkins server hosted by macmini (localhost) to automatic build a deploy for my mobile hybrid apps. That's apps was building with ionic2, and need a deploy for Android (apk) and for iOS (ipa).
But when i run a build from Jenkins, with this shell command
I get this error
that's not all... because i try to execute, from the jenkins folder, the npm i and the result was this:
When i try to build my application from other "folder" and not from jenkins, they works correctly. How i can solve?
Without more information hard to say; you can either just script the things you do when you deploy "manually", or you might want to try a CLI tool like https://www.bitrise.io/cli or https://fastlane.tools which can auto-scan your project and configure a suitable configuration which is then easier to tweak.
In case of Bitrise CLI the base config can be generated with bitrise init in the repo root, and you can also use a visual editor to modify your configuration: https://discuss.bitrise.io/t/how-to-experiment-with-bitrise-configs-locally-on-your-mac-linux/1751
After a lot of time, just find the solution. Jenkins have a own "tools management". So i need to install, into jenkins, a property version of nodeJS, Npm and all other tools i need to deploy the application.
So, first of all you need to install property plugin (in my case nodejs).
After this, going into Jenkins Management System and configure a NodeJS version. That's all

Convert Maven Project to Jenkins

Is it possible to convert Maven Project to Jenkins (I want to convert all the project from Maven to Jenkins)
My organization does not want to use Maven any more. The project has to be completely in Jenkins.
Please let me know the process of converting the project.
Thank you.
As Krishnan said in the comments, Jenkins is not a build tool. Jenkins is a build server that is meant for invoking build tools like Maven. It doesn't replace build tools.
So your question of converting Maven to Jenkins doesn't really make sense, since they are doing different things. However, if you are for some reason unable to use Maven, you have some alternatives. Some I can think of:
Use Gradle
Use Ant (only recommended for simply structured projects with little to no dependencies)
Use command line calls with plain javac like this: How to compile and run a simple java file in jenkins on Windows (not recommended since you have to script everything a build tool does yourself)

How do I configure global Mercurial options (like extensions) in Cloudbees Jenkins?

I have a Cloudbees Jenkins instance configured to build several Mercurial projects. I would like to configure global Mercurial options that would normally go in ~/.hgrc, such as:
[extensions]
eol =
When setting up my own standalone Jenkins instance, I normally just log in as the user running Jenkins and set up its environment.
For Cloudbees, it's not clear how I should handle this. I don't see a way to configure the Mercurial Jenkins plugin to use a specific configuration file. Even if I could do that, I'm not sure where or when to fill in that file.
Can I somehow create a ~/.hgrc that applies to my entire Cloudbees Jenkins instance? Or do I need to do this on a per-job basis? I might be able to set up HGRCPATH in a pre-build step via EnvInect, or maybe modify the project .hgrc via a script build action. However, it seems like neither of these would necessarily happen early enough in the build process to take effect when the job starts.
I feel like I'm missing something obvious. Can someone suggest the proper way to accomplish this?
Go to the system configuration page and create a new Mercurial installation. Leave Installation directory blank and set Executable to simply hg, then set whatever you need in Custom Configuration (see the inline help). Now just select this alternate installation in your project(s).

Jenkins putting '$' characters in file/folder names, breaking automatic backups

I'm using Jenkins v1.546, hosted on a Windows Server 2008 R2 SP1 machine.
I've set up a fairly simple job for building a Maven Java project. It polls the SCM with no schedule and picks up remote build triggers, requiring an authentication token. It uses Subversion and performs clean checkouts with svn update. Additionally, it has a post-build step that archives some build artifacts (i.e., the resulting WAR and WSDLs).
The issue I'm experiencing is that the builds that it stores on the filesystem itself contain invalid characters in their filenames. This causes our automatic backup process to blow up, it being unable to alter or remove those directories/files with the '$'. I myself cannot move/delete those folders or files either, but if I rename it and remove the $, then things work fine. Oh, and if I try to follow one of these links with the $ in it, it doesn't resolve. None of the other jobs seem to do this - just my job, of course. Anyone know why this may be occurring and what I can do to resolve this?
I've attached multiple screenshots that show the bad filename and my Jenkins job setup. I had to white out some company information. If I can provide any additional information to help troubleshoot this, just let me know.
Also, as an update, I did some additional research, looking through the changelogs for each released version of Jenkins since my version (latest is 1.557). I saw three possible issues in the changelogs that could be related, but it's hard for me to tell. I cannot simply upgrade our Jenkins to test out this theory, since I'll need to provide a reason for upgrading beyond a hunch.
https://issues.jenkins-ci.org/browse/JENKINS-21023
https://issues.jenkins-ci.org/browse/JENKINS-20534
https://issues.jenkins-ci.org/browse/JENKINS-21958
The $ is a perfectly valid character in Windows directory name. You can manually make a folder with it, and delete it without any problems.
The com.company$moduleName syntax is used by Jenkins Maven-style job to separate modules of your build. If you don't see this structure for other people's jobs, it is because they are either not building a Maven job, or they don't have multiple modules in a single job.
What is strange though it that these are symlinks (I don't see that in my environment). It is possible that the location that is referenced by the symlink is deleted, but the link remains. In this case, you would not be able to navigate to that location through the link (this is what you are experiencing)
Is it possible that your backup software is deleting the target directories before deleting the links?
In any case, do a simple dir on the directory with the links to see what they link to. And then verify those target locations exists. If they don't, you need to figure out who/what is deleting the links' targets
Edit:
This seems to be more related to the issue that you are facing. Unfortunately, it's marked as "unresolved"
https://issues.jenkins-ci.org/browse/JENKINS-20725
The issue stems from the fact that the symlinks are referencing to targets with / instead of \
My Maven plugin (not Maven version) is 2.6. See if upgrading your Maven plugin in Jenkins will help you. Also, I am running Maven 3.2.2 from the automatic installers. Try with that, as I don't see symlinks in my modules.

Backup maven artifact before install?

I'd like to be able to back up an existing artifact in a repo during the install phase?
Can I do this with maven?
Currently I am coding a xcopy in a bat file that calls mvn install, but I think there has to be a better way?
Additionally, is there a way for me to determine via maven or a windows command prompt the maven repository location?
To get current repository location you can use mvn help:effective-settings help command to print all settings.
As for archiving artifacts before install, it goes against Maven ideology. Basically snapshot versions can be overwritten at any time and release versions must never change. Instead of updating release version you need to change version (e.g. increase it).

Resources