0

I created a web application in my Azure's portal with the intention of deploying the last jenkins.war. I followed all the necessary steps: repository cloning, uploading of the war renamed as ROOT.war and finally got it up and running.

Then I configured git, Maven and added a new job against a GitHub repository of mine.

The problem is that when the jobs starts to build, after checking out correctly from GitHub, I get the following error:

Checking out Revision 63d0972e8a96a1661c6875d5cb39544b18e5d39e (refs/remotes/origin/master)
 > D:\Program Files (x86)\Git\bin\git.exe config core.sparsecheckout # timeout=10
 > D:\Program Files (x86)\Git\bin\git.exe checkout -f 63d0972e8a96a1661c6875d5cb39544b18e5d39e
 > D:\Program Files (x86)\Git\bin\git.exe rev-list 63d0972e8a96a1661c6875d5cb39544b18e5d39e # timeout=10
Parsing POMs
ERROR: Failed to create C:\.m2
Finished: FAILURE

It seems that by default it tries to create the .m2 folder in a place where it doesn't have r/w permission.

Ideally I could configure the settings.xml localRepository in the server to point somewhere else like(D:/.m2),

I found out that I can FTP into the server so I uploaded a settings.xml file and configured the global maven settings to point at that file.

/site/wwwroot/%HOME%/site/wwwroot/jenkins_home/jenkins.mvn.GlobalMavenConfig.xml:

<jenkins.mvn.GlobalMavenConfig>
  <settingsProvider class="jenkins.mvn.FilePathSettingsProvider">
    <path>D:\home\site\settings.xml</path>
  </settingsProvider>
  <globalSettingsProvider class="jenkins.mvn.DefaultGlobalSettingsProvider"/>
</jenkins.mvn.GlobalMavenConfig>

/site/settings.xml:

<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" 
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
          xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
          <localRepository>D:/.m2</localRepository>
</settings>

However it still fails showing ERROR: Failed to create C:\.m2.

Some help?

Laurent.B
  • 213
  • 2
  • 14
codependent
  • 23,193
  • 31
  • 166
  • 308
  • It seems that your settings.xml file is not taken into account. Did you try to copy this file in the home directory of your Jenkins user? (or the one running Tomcat server) – Bruno Lavit Mar 30 '16 at 13:10
  • Thans for the suggestion. Actually I copied it everywhere. From the / of the FTP user and many other folders... – codependent Mar 30 '16 at 13:39

1 Answers1

0

The issue was caused by the permission of Azure WebApp.

According to the answered SO thread jenkins on windows | change .m2 path, I think you can try to install the Jenkins locally and follow the thread answer to change the options, then re-package the Jenkins directory to a zip file and rename its suffix with .war and try to deploy the custom war file on Azure WebApp.

However, there is the Jenkins VM you can create on Azure Marketplace, please see https://azure.microsoft.com/en-gb/marketplace/partners/bitnami/jenkins/.

For more information, you can refer to the MSDN thread https://social.msdn.microsoft.com/Forums/en-US/9b04ffc3-f6cf-45a4-8677-aa0dee348e3d/azure-and-jenkins?forum=WAVirtualMachinesforWindows.

Community
  • 1
  • 1
Peter Pan
  • 23,476
  • 4
  • 25
  • 43