Jenkins - Unable to access to repository - java

I am trying to configure Jenkins to download code from SVN repository and to prepare builds.
Jenkins is on one linux machine - version 1.651.1
Subversion Plug-in 2.5.7
SVN repository is set on another linux machine.
A set repository URL to eg: http://abcsvn/svn/project/branches/branch_a/HEAD/
Unfortunately I get: 'Unable to access to repository' message from Jenkins.
I also tried to put IP instead of abcsvn.
From terminal on linux machine where the Jenkins is installed I can ping IP successfully.
What may be the reason of that kind of problem? The URL is correct, because I paste that in Chrome on my machine and it worked correctly.
I also installed Jenkins on my computer with Windows. I set the same parameters and I am still not able to connect to svn repo. In Eclipse I don't have any problem to commit and checkout from svn repo.
If you need any more information to diagnose this problem I will try to complete this post.

Exception says that you have not provided credentials of your svn repository. In newer version of svn we can provide this credential while we configure workspace. In your version it can be provided from manage Jenkins menu.

Related

How to let maven project work locally by intelij-idea?

We have a maven project works fine in a internet enabled environment, now we need make it work in a local environment by IntelliJ IDEA Community Edition .
we have try following actions:
in setting->build->maven:
check the box "work offline"
download all needed jars into a local folder
in settings.xml set local Repository, such as
C:\FCA\Repository
4.build the project, it seems that some packages can be find in pom.xml(no error message in pom.xml), but can't be find in java code , and build failed. You can refer to attached picture for details
How can we get it done locally? thanks a lot!
Under "Settings -> Build, Execution, Deployment -> Maven" you can find options:
Maven home directory
User settings file
Local repository
There you have to provide path to your local maven installation (by default IntelliJ has it's own Maven provided). It should automatically read your settings.xml file and set local repository. If not please also provide those two and it will work fine with your local libs.
First of all, run mvn dependency:go-offline. Then you can build in offline mode as long as you don't change any of the dependencies.
If you do this to work inside a company with several developers, think about setting up a Nexus/Artifactory for you company.

Cannot run Maven on Jenkins with Ubuntu

I am struggling to get a simple maven project running on Jenkins, which runs on my new Ubuntu server (16.04.)
I have installed Jenkins onto an Ubuntu, installed Maven and JDK.
I can connect to bitbucket and access my remote repository and get hold of my code. However, when I try to build I get the message
cannot run program "mvn" (in directory "/var/snap/jenkins/workspace/project") no such file or directory
I have added $JAVA_HOME and $MAVEN_HOME to my /etc/environment as variables and also into my path.
I have looked at the Global Tool Configuration, but this seems to be no help.
When I set the Maven installer to point at Maven home I get a message
/usr/share/maven is not a directory on the jenkins master
When I try to get Jenkins to install maven for me I get
Failed to install <truncated>apache-maven-3.5.3.bin.zip to /var/snap/jenkins/6/tools
...
Caused by: java.security.InvalidAlgorithmParameterException: the trustAnchors parameter must not be empty
I think I have hit a dead end. What could I be missing, or how can I get past these obstacles ?
Many Thanks
Go to Manage Jenkins -> Global Tool Configuration. I always elect to have Jenkins install and manage Maven, vs install and bring my own.
It has taken a long time to get to the bottom of this.
By default the
sudo apt-get install jenkins
seems to install a Snap version of Jenkins.
This snap version holds data in different locations (which is why I struggled to find the initialAdminpassword
Additionally, the snap setup only has a JRE, which cannot be overridden to a JDK, and therefore does not seem to work properly with Maven.
Eventually, I completely uninstalled Jenkins, and then followed the instructions on the official Jenkins site:
https://pkg.jenkins.io/debian-stable/
This overrides the base apt-get packages, and points to the jenkins.io packages.
From here on in, it all behaved as per the documentation.

Unable to run mvn.bat on Jenkins with master/slave on Windows

I have a master/slave setup running on Windows 2008 RC2. The master doesn't really do anything other than being a master.
The slave I have then runs the build, which works fine for maven projects (Jenkins maven projects). If I create a free-style project I cannot run mvn.bat using a maven target. The exception is that mvn.bat cannot be resolved (path not found).
Maven is installed on the slave through the master, that is, maven was pushed onto the slave through the "install maven" feature.
Does anyone have an idea as to how I can resolve this? I'm using the interface for installing as I do not have access to the system through e.g. remote desktop. Thus I can upgrade/change the maven version for one or more projects, so a system property does not solve my problem on the long run.
As Slav wrote, using "Default" as Maven Version will find what is installed on the operating system (that is, somewhere on the system path).
The solution is to select a version and not "Default". I have installed Maven 3.0.5 using the Jenkins installed, selecting this version fixed the issue. Or you could setup the path on the system, but this requires access to the server (which I do not have, only the web interface).

m2e with ssl certificate-based authentication

TL;DR
How to make Eclipse's built-in Maven connect to an HTTPS repository that uses certificate-based authentication?
It seems that m2e is able to find the keystores, but unable to connect. Command-line Maven works like a charm using exactly the same keystores. Run as -> Maven build works with external Maven and not with the embedded one.
Problem
I have a Maven project with a dependency. That dependency is available in a repository that uses SSL certificate-based authentication in addition to regular username-password combination. I need to make it work in Eclipse Luna, with the built-in Maven. All I am able to get is handshake_failure. Investigation of the logs shows that the built-in Maven is unable to find a matching certificate.
When I use Run as -> Maven build with an external Maven, or command-line Maven, it successfully connects to the repository and fetches the artifact exactly as needed.
The interesting thing is, both external and embedded Mavens have the same version (3.2.3).
Setup
I pass these parameters through eclipse.ini:
-Djavax.net.ssl.trustStore=java.cacerts
-Djavax.net.ssl.trustStorePassword=******
-Djavax.net.ssl.keyStore=private.cacerts
-Djavax.net.ssl.keyStorePassword=******
-Djavax.net.debug=ssl,handshake
The trustStore file contains:
the whole certificate chain for the repository I connect to (the chain ends with a self-signed certificate), one of them being stored under the alias repository.location.url (literal repository location here, e.g. myrepository.com)
certificate for maven central
The keyStore file contains an imported PKCS certificate under an alias of the repository.
There seems to be no problem at all with the setup, as the command-line Maven works. If I use external Maven or command-line one, it works. If I swich to embedded one (which is always used for resolving dependencies), handshake error shows up.
What am I doing wrong? I might be missing something completely obvious. Any help would be appreciated.
Options that didn't work for me
Installing certificate to java > jre > lib > security > cacerts
Providing cacerts in java run configuration vm arguments
Updating eclipse to latest versions like mars or neon
Updating maven plugin for eclipse to 1.7.0
Steps that resolved the issue for me
Download certificate file & add in eclipse at Preferences > Remote Systems > SSL > Add
Clear .m2 > repository folder of all existing files
Open eclipse, right-click on project and Select Maven > Update Project. Choose Force Update of Snapshots/Releases
updated on 9/19/2017
If nothing else works, Installing the certificate to Java on your machine # java > jre > lib > security > cacerts can help
I had exactly the same problem: Eclipse could not connect to external maven repository using embedded maven installation in case the repository requires a client SSL certificate.
The problem was solved by upgrading to latest jvm (in my case - 1.8.0u52) and upgrading Eclipse m2e plugin to version 1.6.1 (with Eclipse version 4.4.0).
In your run configurations select your maven build and then select the JRE tab at the top of the dialog. Put your SSL parameters into the VM arguments text-area.
that's what fixed it for me.
I managed to fix it by setting external maven in eclipse.
Eclipse->Window->Preferences->Maven->Installations->Add

How to set NetBeans 7 internet connection?

I am using NetBeans 7. Tried to create a Maven Java project, failed.
In NetBeans
mvn.bat -DarchetypeVersion=1.1 -Darchetype.interactive=false -DgroupId=com.mycompany -DarchetypeArtifactId=maven-archetype-quickstart -DarchetypeRepository=http://repo1.maven.org/maven2/ -Dversion=1.0-SNAPSHOT -DarchetypeGroupId=org.apache.maven.archetypes -Dbasedir=F:\\NetBeansProjects -Dpackage=com.mycompany.mavenproject1 -DartifactId=mavenproject1 "-Dmaven.repo.local=C:\\Documents and Settings\\xxx\\.m2" --batch-mode archetype:generate
It failed, because
Could not transfer metadata org.codehaus.mojo/maven-metadata.xml from/to central (http://repo1.maven.org/maven2): Error transferring file: Connection timed out: connect
Then copy that command into DOS, it works.
Looks like NetBeans can't connect to internet. Eclipse on the same machine can connect to remote internet.
The issue is that NetBeans 7 comes bundled with an embedded version of Maven. This means that any proxy settings you may have configured under your downloaded Maven distribution are not used by NetBeans.
You have two options:
Tools > Options > Miscellaneous > Maven > Maven Home -- point NetBeans to your existing Maven download; that is, where you have configrued settings.xml with your proxy settings;
Edit path/to/nb7/java/maven/conf/settings.xml with your proxy settings.
Well it is not necessarily internet issue
If you are behind proxies you need to tell maven in settings.xml about proxy
If that lib ins't available on the maven repos download it from official sitre and install it manually
Either
Disable antivirus firewall protection for a while.
Or
Add netbeans in exception list of the firewall.
In my case Avast firewall had blocked connection and I've disabled it for a while and it worked.
That's it !!!

Categories

Resources