Search code examples
mavenazure-devopsjmetercontinuous-integrationmaven-3

LocalRepositoryNotAccessibleException Could not create local repository at /testartifacts/m2repository


I'm running a CI pipeline in Azure DevOps with a Maven build step called "Download provided dependency JARs".

This step was working before, however it's suddenly giving me this error:

org.apache.maven.repository.LocalRepositoryNotAccessibleException: Could not create local repository at /testartifacts/m2repository

I'm also getting a warning:

##[warning]Could not parse the effective POM.

This is what it looks like in DevOps: enter image description here

I've set it to clean the working directory before the build is run, but this didn't help. enter image description here

From what I've read, it seems to be a permissions issue.

Shouldn't the build agent already have permissions?

I appreciate your help.

This is my pom.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>au.com.mycompany.perfunittests</groupId>
    <artifactId>myapplication</artifactId>
    <version>1.0-SNAPSHOT</version>

    <profiles>
        <!-- Load Test -->
        <profile>
            <id>profile.loadTest</id>
            <!-- Test will only be chosen when -DtestType=load -->
            <activation>
                <!-- Test will be chosen when property testname is not supplied, i.e. the default -->
                <property>
                    <name>!testname</name>
                </property>
            </activation>
            <properties>
                <testname>loadtest.myapplication</testname>
                <isbenchmarktest>false</isbenchmarktest>
            </properties>
        </profile>
        <!-- Benchmark Test for Common -->
        <profile>
            <id>profile.benchmarkTest.Common</id>
            <activation>
                <property>
                    <name>testname</name>
                    <value>unittest.myapplication.common</value>
                </property>
            </activation>
            <properties>
                <testname>unittest.myapplication.common</testname>
                <isbenchmarktest>true</isbenchmarktest>
            </properties>
        </profile>
        <!-- Benchmark Test for Configuration -->
        <profile>
            <id>profile.benchmarkTest.Configuration</id>
            <activation>
                <property>
                    <name>testname</name>
                    <value>unittest.myapplication.configuration</value>
                </property>
            </activation>
            <properties>
                <testname>unittest.myapplication.configuration</testname>
                <isbenchmarktest>true</isbenchmarktest>
            </properties>
        </profile>
        <!-- Benchmark Test for Dashboard - note this is legacy Dashboard API calls -->
        <profile>
            <id>profile.benchmarkTest.Dashboard</id>
            <activation>
                <property>
                    <name>testname</name>
                    <value>unittest.myapplication.dashboard</value>
                </property>
            </activation>
            <properties>
                <testname>unittest.myapplication.dashboard</testname>
                <isbenchmarktest>true</isbenchmarktest>
            </properties>
        </profile>
        <!-- Benchmark Test for Management -->
        <profile>
            <id>profile.benchmarkTest.Management</id>
            <activation>
                <property>
                    <name>testname</name>
                    <value>unittest.myapplication.management</value>
                </property>
            </activation>
            <properties>
                <testname>unittest.myapplication.management</testname>
                <isbenchmarktest>true</isbenchmarktest>
            </properties>
        </profile>
    </profiles>
    
    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <!-- No need to run deploy lifecycle -->
        <maven.deploy.skip>true</maven.deploy.skip>

        <!-- No need to create a JAR -->
        <jar.skipIfEmpty>true</jar.skipIfEmpty>
        <maven.install.skip>true</maven.install.skip>

        <!-- Run in perftest env unless overridden using -Denv -->
        <env>perf</env>
    </properties>

    <repositories>
        <repository>
            <id>mycompanyproject-visualstudio.com-maven</id>
            <url>https://mycompanyproject.pkgs.visualstudio.com/_packaging/maven/maven/v1</url>
            <releases>
                <enabled>true</enabled>
            </releases>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
    </repositories>

    <build>
        <plugins>
            <plugin>
                <groupId>com.lazerycode.jmeter</groupId>
                <artifactId>jmeter-maven-plugin</artifactId>
                <version>2.8.6</version>
                <executions>
                    <execution>
                        <id>jmeter-tests</id>
                        <goals>
                            <goal>jmeter</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <jmeterVersion>5.0</jmeterVersion>
                    <!-- JMX file for unittests lives in the same directory as pom.xml -->
                    <testFilesDirectory>${project.basedir}</testFilesDirectory>
                    <testFilesIncluded>
                        <jMeterTestFile>${testname}.jmx</jMeterTestFile>
                    </testFilesIncluded>
                    <!-- Need to save in CSV format for lightning plugin -->
                    <resultsFileFormat>csv</resultsFileFormat>
                    <!-- Don't append timestamp to JTL file, so lightning can find it more easily -->
                    <testResultsTimestamp>false</testResultsTimestamp>
                    <!-- Don't stop the test on a failure -->
                    <ignoreResultFailures>true</ignoreResultFailures>
                    <propertiesUser>
                        <env>${env}</env>
                        <url.myapplication>perfweb.myapplication.com</url.myapplication>
                        <unittest.path.resources>${project.basedir}</unittest.path.resources>
                        <unittest.path.testdata>${project.basedir}/data</unittest.path.testdata>
                    </propertiesUser>
                    <!-- Additional output JTL format for lightning plugin -->
                    <propertiesJMeter>
                        <httpclient.reset_state_on_thread_group_iteration>false</httpclient.reset_state_on_thread_group_iteration>
                        <jmeter.save.saveservice.print_field_names>true</jmeter.save.saveservice.print_field_names>
                        <jmeter.save.saveservice.successful>true</jmeter.save.saveservice.successful>
                        <jmeter.save.saveservice.label>true</jmeter.save.saveservice.label>
                        <jmeter.save.saveservice.time>true</jmeter.save.saveservice.time>
                    </propertiesJMeter>
                    <customPropertiesFiles>
                        <file>${project.basedir}/${testname}.threadgroups.conf</file>
                    </customPropertiesFiles>
                    <!-- Additional libraries (mostly) from jmeter-plugins.org -->
                    <jmeterExtensions>
                        <artifact>au.com.mycompany:timinglistener:0.2-SNAPSHOT</artifact>
                        <artifact>com.google.code.gson:gson:2.8.2</artifact>
                        <artifact>com.opencsv:opencsv:4.1</artifact>
                        <artifact>com.sumologic.plugins.log4j:sumologic-log4j2-appender:1.7</artifact>
                    </jmeterExtensions>
                    <jMeterProcessJVMSettings>
                        <xms>2048</xms>
                        <xmx>2048</xmx>
                        <arguments>
                            <argument>-Dunittest.path.logs=${project.build.directory}/jmeter/logs</argument>
                            <argument>-Dunittest.testname=${testname}</argument>
                            <argument>-Dlog4j.configurationFile=file://${project.basedir}/log4j2.xml</argument>
                        </arguments>
                    </jMeterProcessJVMSettings>
                    <downloadExtensionDependencies>true</downloadExtensionDependencies>
                </configuration>
            </plugin>
            <plugin>
                <groupId>uk.co.automatictester</groupId>
                <artifactId>jmeter-lightning-maven-plugin</artifactId>
                <version>1.5.0</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>lightning</goal>
                        </goals>
                        <configuration>
                            <mode>verify</mode>
                            <!-- Lightning XML definition file lives in the same directory as pom.xml -->
                            <testSetXml>${project.basedir}/${testname}.xml</testSetXml>
                            <!-- Test output JTL file written to target/jmeter/results/<testname>.csv -->
                            <jmeterCsv>${project.build.directory}/jmeter/results/${testname}.csv</jmeterCsv>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

Solution

  • Turns out all I had to do was change the Agent Specification from ubuntu-18.04 to vs2017-win2016. enter image description here