Maven + Artifactory + Eclipse Setup
Motivation:
We work on a company and we need to follow thier rules. A new Artifactory instance has been set up by the BARS and Platform teams to improve build performance on the Jenkins instance. Follow these steps to get your developer workstation configured to work with it.
This setup is for Windows only
Get your settings.xml working
- Login to Artifactory (url provided by your organization), and click on 'Artifacts' on the left vertical toolbar, then click 'Set Me Up' on the right top corner. After that select Maven and type your employee password, then click the arrow to unlock and finally click 'Generate Maven Settings'. Download the file 'settings.xml' and inside copy the encrypted password which you'll need below. (Here is a more detailed step by step)
- Locate your .m2 folder, it's usually in your user directory. Once there, paste the "settings.xml" you downloaded and write your username and password on the corresponding fields.
Maven paths
- Now we need to include the maven paths of our installations. Type:
mvn -version #If you get something like this: Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T14:49:05-05:00) Maven home: C:\ProgramData\Development\apache-maven-3.5.3\bin\.. Java version: 1.8.0_212, vendor: Oracle Corporation Java home: C:\Program Files\Java\jdk1.8.0_212\jre Default locale: en_US, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"
Then it means you can jump to the Eclipse setup already. If not, continue below:
Go to the Windows OS start menu and search for 'Edit enviroment variables for your account', then make sure you have something like this (the path may be different so make sure you edit it)
For the System variables you are going to need admin priviledges depending on your access, if so you can contact the support team using the Chat and tell them you need to edit those files. Once you have access, make sure you have something similar to this:
and for the path:
After that close the terminal and run again the command 'mvn -version' to make sure you get an output similar to the one mentioned above.
Eclipse
- Make sure your User Settings are setup.
Go toWindow -> Preferences -> Maven -> User Settings
and where it says User settings, click on Browse... to locate yoursettings.xml
file in the.m2
folder, after that click on Update Settings and Apply and Close.
Do not change any other setting such as work offline because that will create build problems. - Add your runtime enviroment (or check it):
Go toWindow > Preferences > Java > Installed JREs
and check your installed JREs. You should have an entry with a JDK there. - Git Configurations:
Open Eclipse.
Go toWindow -> Preferences -> Team -> Git -> Configuration
Add entries:Key: core.autocrlf; Value: false
Key: http.sslVerify; Value: false
- Setup Eclipse Network Configurations:
Open Eclipse. Go toWindow -> Preferences -> General -> Network Connections
Go toActive Provider: Native
Check only the row that has Schema: HTTP; Host: Dynamic Example:
Troubleshooting
For this error refer to settings.xml above
Could not calculate build plan: Plugin org.apache.maven.plugins:maven-resources-plugin:2.6 or one of its dependencies could not be resolved: Cannot access central
For this error refer to Maven paths above
The JAVA_HOME environment variable is not defined correctly This environment variable is needed to run this program NB: JAVA_HOME should point to a JDK not a JRE How to add Maven to the Path variable?