I am actually trying to develop a Jenkins plugin using maven but I am unable to test it.
I created my project with the command mvn -cpu hpi:create. I called the project jenkins-plugin-tutorial. I packaged it with mvn package or mvn install and run the Jenkins server with mvn hpi:run.
By default, there is a HelloWorlBuilder for testing purpose that should appear at the Jenkins configuration page (Jenkins Menu -> Manage Jenkins -> Configure System) or under the Build section, but it does not display.
I followed these two tutorials (here and here) step by step many times by making sure that I do not make a mistake but it still dont work.
Maybe I have made something wrong. Can somebody gives me some hint how to correct my errors.
In pom.xml, try changing parent to this:
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>1.454</version>
</parent>
I just did quick test with that hpi:create, and it worked for me, I got both global and job config things as expected, but I had to do that change to pom.xml, before I got it to compile.
That is, I did:
mvn hpi:create
entered groupId foo.hyde.jenkins.plugins, artifactId hello-world when prompted.
cd hello-world
mvn install failed
Edit pom.xml to change the parent
mvn install succeeded
mvn hpi:run -Djetty.port=8092 succeeded (Using that port because other Jenkins is already in default port, otherwise -D... not needed.)
Go to http://localhost:8092, check global config, create job and add the build step
And it worked for me.
I'm using Maven 2, version 2.2.1.
I finally find the answer to my questions. The problem is that I was using an old version of maven, the 2.2.1 version. So I change to the last version, 3.0.4, everything is fine now.
Related
So, I've successfully completed the installation of IntelliJ using hsac-fitnesse-fixtures installation guide.
Next I've set up a project, added the IntelliJ Idea Fitnesse plugin, added a Maven configuration.
FitNesse runs correctly, ending with Starting FitNesse on port: 9090
Next I try to run a test on a test environment, but that fails.
The 1st failure is:
Could not invoke constructor for SeleniumDriverSetup[0]
The 2nd failure is:
The instance scriptTableActor.startDriverFor. does not exist
This is an HSAC environment.
I'm sorry I did not see you question earlier.
It appears I did not update the installation guide when making a change to how the wiki should be started from the IDE. I only updated the project's README.
Anyway the problems lies it the command used in the maven configuration the guide instructed you to make. The Maven command has to be compile dependency:copy-dependencies exec:exec and the guide missed the 'dependency:copy-dependencies' part. Using compile dependency:copy-dependencies exec:exec should fix your problem.
I got a maven project (myApp) depending on another maven project in snapshot version.
like:
<dependency>
<groupId>org.group.dep</groupId>
<artifactId>arty</artifactId>
<version>12.1.4-SNAPSHOT</version>
</dependency>
But I got a problem with this after the "arty" got an update without changing the version (I know that would be the cleanest solution).
I build the myApp local and got still the old version of the "arty" dependency.
I verified tow option working for me (and a college):
1) Manual cleaning of the local repository: navigating to my .m2/repo/org/group/dep/arty and deleted all folders inside. After rebuilding the myApp local it was working fine - arty was downloaded form the artifactory.company.com again with the updated content.
2) Local building of the arty package so it got updated in the local repository. After rebuilding the myApp local it was working fine.
But I got similar problem on the Jenkins:
I got a Jenkins job just building org.group.myApp without building before org.group.dep.arty. It failed for the missing changes form "arty".
What can I do now to solve my problem there?
I can not rely on first building org.group.dep.arty as I can not be sure for Jenkins to run both jobs on the same host using same local repository (I don't want to change that).
Somehow the myApp-Jobs was failing after I manually cleared on that Jenkins node the org.group.dep.arty in the repository and running than the myApp-job (was somehow not downloading the package).
I finally found the mvn -u but as I tried this I was as well disappointed.
I tried different maven versions on that jenkins and got the same result.
Is there no way to force the update of the snapshot versions?
Is this "another project" is a part of the same multi-module project?
If so you can build your project with --also-make options so that maven will effectively rebuild your module and all of its dependencies
If its an entirely different project, use mvn -U to forcefully download all the snapshot dependencies of your project.
If there is a particular issue with one concrete dependency consider using mvn dependency:get. This get goal of maven-dependency-plugin downloads one specific artifact from the remote repository
Here is a link to the plugin documentation
The simplest solution to redownload -SNAPSHOT is by using the command line option: -U or as long option --update-snapshots
Furthermore your project sounds like the need for a multi module build which prevents such issues. Or you might need to define those Jobs depending on each other (There is an option to build if a SNAPSHOT has been updated in Jenkins).
I am trying to build a maven project in Jenkins with Build Profile ID of pom.xml. But Jenkins is only building with dev profile and not catching any of other profiles. with the same pom.xml.
I've tried building on command prompt and it's working fine, I just cannot do it in Jenkins.
I am having similar issue running maven 3.3.9 from Jenkins ver. 2.138.
So far, with time consuming trial and error, I have found that Jenkins does not tolerate a space between the -P and the profile name AND it can only handle a single profile. So you should be able to get something like this to work:
mvn groupId:artifactId:goal -Pprofile-1-only
how did you set-up your Jenkins to run the command?
Profiles should b specified using the -P option:
mvn groupId:artifactId:goal -P profile-1,profile-2
http://maven.apache.org/guides/introduction/introduction-to-profiles.html
My guess is that in your Jenkins config (build steps), you have not specified anything, or you provide the wrong profile.
Could you try and let us know?
First off I'm not on a separate system in order to post this question and have no way of connecting the other system to the internet. This machine I'm on is locked down so I am not able to install or do anything other than email and view the web for research.
Used Reference: http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
Environment: Maven 2.2.1
Yes the Maven build functions fine for the existing project.
Situation:
I'm new to Maven and this project I'm on, the other developers are GONE. There is a .bat file that was used to run the project builds and that's all I know of Maven.
I am attempting to learn Maven on the other machine that has it installed I am using the Apache site mentioned above. The instructions tells me to create a project using the command
mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false but, I get the
'BUILD FAILURE'
Error reading archetype catalog http://repo1.maven.org/maven2... (and other errors)
The desired archetype does not exist (org.apache.maven.archetypes:maven-archetype=quickstart:1.0
So, question is what am I to do in order to create a dummy project so I can see WTF is going on with Maven when I'm in an environment that is not able to reach the 'maven.org' site?
If there are threads on learning Maven offline that someone can point me to that too would be of use. I'm not seeing anything though that helps me get started on this.
Thank you for looking and your time.
The problem seems that maven is looking for the architype on the central repository.
You can create your own pom.xml with an editor:
http://maven.apache.org/guides/introduction/introduction-to-the-pom.html
I believe that the answer will be really easy, but I haven't figure out how to do it.
The problem is:
I have a third-party project, which is being cloned from github, so I'm not going to change anything there, but I need this project for my work with MUnit.
The project is mule-interceptor-module and it has a version 3.4-M4-SNAPSHOT.
I created a build in Jenkins and I want to get mule-interceptor-module-3.4-M4-SNAPSHOT.jar after it, but Jenkins REMOVES -SNAPSHOT from the jar name and updates pom.xml with new version: 3.4-M4 instead of 3.4-M4-SNAPSHOT. The project, which uses this one (munit) in its dependencies has 3.4-M4-SNAPSHOT. So I need the SNAPSHOT in version.
What I tried to do:
I tried to build the same project on the server, which my Jenkins is installed on, using just mvn clean install and I got mule-interceptor-module-3.4-M4-SNAPSHOT.jar.
The question is:
How to tune Jenkins so that I could finally have SNAPSHOT build?
My job setup:
JDK: jdk 1.6.0_45
Source Code Management:
Git
Repository URL: https://github.com/mulesoft/mule-interceptor-module.git
Branch Specifier (blank for default):3.4.x
Repository browser: githubweb
URL: https://github.com/mulesoft/mule-interceptor-module/
Pre Steps:
Execute shell: git checkout 3.4.x
Build:
Root POM: pom.xml
Goals and options: clean install
Post steps:
Run regardless of build result
Build Settings:
- Publish Checkstyle analysis results
- Publish FindBugs analysis results
Jenkins Console output
Jenkins Console output wirh -X
The solution:
in Jenkins /Configuration/Build/Advanced check in Use private Maven repository
Choose Strategy: Local to the workspace
remove everything from /workspace folder by rm -R *
#Grove: thanks you a lot for the support!
I can see in the logs: Your branch is ahead of 'origin/3.4.x' by 1 commit. and Building Mule Interceptor Module 3.4-M4. Could it be that your revision has 3.4-M4 as a version in the pom?
The solution:
in Jenkins /Configuration/Build/Advanced check in Use private Maven repository
Choose Strategy: Local to the workspace
remove everything from /workspace folder by rm -R *
Why are using SNAPSHOT dependency from a 3rd party ? The standard is to use a RELEASE version, right ?
Answer Anyways the fact that using the private maven repository worked for you proves just one thing, that the negative cache in your server's maven repo was causing the problem. See this Q and A from me more than a year back, when exactly the same solution worked for me, albiet for a different problem and I marked it as the answer. Only to find a few months later that I did not go to the root cause of the problem and just found a workaorund.
To test this theory, set <updatepolicy> true <updatepolicy> and use maven -U clean install. It will have the same effect as your solution of using a private repo.