Execute Appium test cases via Appcenter task in Azure Devops pipeline - java

How to configure correctly and execute the test cases using Appcenter task in the Azure VSTS pipeline.
In the repository, have two directories {source, testcase} in the parent directory. The build executes in hosted Mac OS triggered by VSTS pipleline.
In the first task, from source directory, create the .apk file and copy to artifacts staging directory.
In the second task, Run the Automated test cases using Appcenter task "Test with Visual Studio App Center".
I am having trouble understanding, how appium works and make it work via VSTS pipeline.
In the first approach, after the .apk buil then would like to execute the test cases using Appcenter and Appium. but it was not successful since one of my test case file has hardcoded values like below.
have one file /src/test/java/company/domain/com/util/android/UtilSetup.java which has hardcoded values like below. because of hard-coded values, it was looking for appium and it throws connection issues. so went on to second approach to make the pipeline work.
public class UtilSetupAndroid {
public static EnhancedAndroidDriver<MobileElement> driverAndroid;
public static void setupAndroid() throws MalformedURLException {
DesiredCapabilities caps = new DesiredCapabilities();
caps.setCapability(MobileCapabilityType.PLATFORM_NAME, Platform.ANDROID);
caps.setCapability("platformVersion", "7.0");
caps.setCapability("deviceName", "hexa-decimal-value-here");
caps.setCapability("udid", "same-hexa-decimal-value-here");
caps.setCapability("appPackage", "cl.company.transformacion.appcompanymobile");
caps.setCapability("appActivity",
"cl.company.transformacion.appcompanymobile.enrolamiento.activity.CargaInicialActivity");
caps.setCapability("app", "/home/directory/Appium-test/project.apk");
caps.setCapability("unicodeKeyboard", true);
caps.setCapability("resetKeyboard", true);
URL url = new URL("http://localhost:4723/wd/hub");
driverAndroid = Factory.createAndroidDriver(url, caps);
driverAndroid.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
}
}
In the second approach, did a local build(mvn test) and it has generated the *.class files of test cases. The committed the "test-classes" directory in the test cases build directory and referred in Appium configration secion. Committing the *.class files is not right approach i believe, but to make the pipeline work, did it like this.
Then, build pipeline started executing the Appium but ended with unresolved dependency error. I had the same issue and to overcome the issue, added the company nexus repository to directly download from Nexus. but still error occurs.
pom.xml has dependencies like below:
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>6.1.0</version>
</dependency>
<dependency>
<groupId>com.microsoft.appcenter</groupId>
<artifactId>appium-test-extension</artifactId>
<version>1.0</version>
</dependency>
build section like below:
<profiles>
<profile>
<id>prepare-for-upload</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>3.0.0-M3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.10</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/upload/dependency-jars/</outputDirectory>
<useRepositoryLayout>true</useRepositoryLayout>
<copyPom>true</copyPom>
<addParentPoms>true</addParentPoms>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-help-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<id>generate-pom</id>
<phase>package</phase>
<goals>
<goal>effective-pom</goal>
</goals>
<configuration>
<output>${project.build.directory}/upload/pom.xml</output>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
<id>copy-testclasses</id>
<phase>package</phase>
<goals>
<goal>testResources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/upload/test-classes</outputDirectory>
<resources>
<resource>
<directory>${project.build.testOutputDirectory}</directory>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>3.0.0-M3</version>
</plugin>
</plugins>
</reporting>
<repositories>
<repository>
<id>jcenter</id>
<url>https://jcenter.bintray.com/</url>
</repository>
</repositories>
</profile>
</profiles>
<repositories>
<repository>
<id>COMPAY_NAME.cl</id>
<url>http://maven.COMPANY_NAME.cl/nexus/content/repositories/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<distributionManagement>
<repository>
<id>COMPANY_NAME.cl</id>
<url>http://maven.COMPANY_NAME.cl/nexus/content/repositories/public/</url>
</repository>
</distributionManagement>
Error message:
Reason: [INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building run-test 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[WARNING] The POM for com.microsoft.appcenter:appium-test-extension:jar:1.0 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 9.958 s
[INFO] Finished at: 2019-06-19T01:45:22+02:00
[INFO] Final Memory: 9M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project run-test: Could not resolve dependencies for project com.xamarin.appium:run-test:jar:1.0-SNAPSHOT: Could not find artifact com.microsoft.appcenter:appium-test-extension:jar:1.0 in cache1 (http://cache1:6081/maven2) -> [Help 1]
[EDIT]
Additional information, my pom.xml does not have the project in "com.xamarin.appium". It seems the error from App Center. Also the maven repo in the output is not my maven repository.
The REST call from appcenter-cli to App Center is returned with status 2xx for first few calls and finally throws the error.
[command]/usr/local/bin/appcenter test prepare appium --artifacts-dir /Users/vsts/agent/2.153.2/work/1/a/AppCenterTest --build-dir /Users/vsts/agent/2.153.2/work/1/s/Test/test_case --debug --quiet
Using appcenter-cli version: 1.1.18
Preparing tests... done.
Tests are ready to run. Manifest file was written to /Users/vsts/agent/2.153.2/work/1/a/AppCenterTest/manifest.json
[command]/usr/local/bin/appcenter test run manifest --manifest-path /Users/vsts/agent/2.153.2/work/1/a/AppCenterTest/manifest.json --app-path /Users/vsts/agent/2.153.2/work/1/a/AppCOMPMobile.apk --app COMPchile/AppAndroid --devices COMPchile/set-pruebas-vsts --test-series pruebas --locale en_US --debug --quiet --token ***
Using appcenter-cli version: 1.1.18
Preparing tests... done.
(truncated)
Response status code: 200
Body: {"message":["Tests completed. Processing data."],"wait_time":10,"exit_code":null}
Current test status: Tests completed. Processing data.
logFilter, request: {
"rawResponse": false,
"queryString": {},
"url": "https://api.appcenter.ms/v0.1/apps/COMPchile/COMPAppAndroid/test_runs/b8b88f0f-226c-4564-98b5-dc582cca81c8/state",
"method": "GET",
"headers": {
"Content-Type": "application/json; charset=utf-8",
"user-agent": "appcenterCli/1.1.18 NodeJS/v6.17.0 darwin/18.6.0",
"x-api-token": ***
},
"body": null
}
Response status code: 200
Body: {"message":["Failed!","Reason: [INFO] Scanning for projects...\n[INFO] \n[INFO] ------------------------------------------------------------------------\n[INFO] Building run-test 1.0-SNAPSHOT\n[INFO] ------------------------------------------------------------------------\n[WARNING] The POM for com.microsoft.appcenter:appium-test-extension:jar:1.5 is missing, no dependency information available\n[INFO] ------------------------------------------------------------------------\n[INFO] BUILD FAILURE\n[INFO] ------------------------------------------------------------------------\n[INFO] Total time: 2.132 s\n[INFO] Finished at: 2019-06-21T19:23:12+02:00\n[INFO] Final Memory: 10M/309M\n[INFO] ------------------------------------------------------------------------\n[ERROR] Failed to execute goal on project run-test: Could not resolve dependencies for project com.xamarin.appium:run-test:jar:1.0-SNAPSHOT: Could not find artifact com.microsoft.appcenter:appium-test-extension:jar:1.5 in cache1 (http://cache1:6081/maven2) -\u003e [Help 1]\n[ERROR] \n[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.\n[ERROR] Re-run Maven using the -X switch to enable full debug logging.\n[ERROR] \n[ERROR] For more information about the errors and possible solutions, please read the following articles:\n[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException\n"],"wait_time":10,"exit_code":2}

Related

Maven ignoring tests on build

Currently trying to test a project and for some reason, it won't run the tests when using mvn clean install. Strangely enough though, right-clicking on the project and do Run 'All Tests' on Intellij, runs all the tests well.
The folder is called test, with the tests having a Test added after the name of the class they are testing. I have this configuration in the POM file set up:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>11</release>
<showDeprecation>true</showDeprecation>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
</plugin>
with the java version being set as such: <java.version>11</java.version>
and the junit dependency being set like so:
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
<type>jar</type>
</dependency>
This will result in:
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) # ******* ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
Usually I don't need to even add the maven-surefire-plugin under the plugins tag, although I did this to specify the version, maybe that might help but it's of no use.
Any idea what the issue might be?
UPDATE 1:
Added some configuration for the surefire plugin: <useModulePath>false</useModulePath>
Logs from mvn -X test: https://controlc.com/0e9faba9
The version 3.0.0-M6 has been deployed to the Maven Central repository.
This issue is fixed.
Pls check the POM and the configuration useModulePath=false as a workaround.
http://quabr.com:8182/66637732/maven-ignoring-tests-on-build
Now the workaround can be removed.
Yes we have a bug in surefire 3.0.0-M5 (when JDK 9+ and no JPMS is used) but we published the workaround on the Stackoverflow several times.
Pls check it out with a temporal workaround
mvn test -Dsurefire.useModulePath=false
The fix is already done and it will be released in the version 3.0.0-M6. There the workaround useModulePath=false would not be needed anymore.

Vaadin: Can't build on production mode

I try to put my app in production mode, I'm on vaadin flow 14.1.5, the profile is already on the pom.xml.
production profile on the pom.xml is like this:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>-Dvaadin.productionMode</jvmArguments>
</configuration>
</plugin>
<plugin>
<groupId>com.vaadin</groupId>
<artifactId>vaadin-maven-plugin</artifactId>
<version>${vaadin.version}</version>
<executions>
<execution>
<goals>
<goal>prepare-frontend</goal>
<goal>build-frontend</goal>
</goals>
<phase>compile</phase>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
However when running on the terminal: mvn clean package -P production
I got this:
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.437 s
[INFO] Finished at: 2020-04-25T00:22:09-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.vaadin:vaadin-maven-plugin:14.1.5:build-frontend (default) on project project-maya: Execution default of goal com.vaadin:vaadin-maven-plugin:14.1.5:build-frontend failed: Unsupported class file major version 58 -> [Help 1]
I'm on testing at the moment so I don't really care about running on development mode but I will be running on production mode soon and I really don't know what to do to fix this.
Edit: Vaadin 14.1.26 has now been released, which includes the fix for not being able to build with Java 14 (Flow issue #7918).
This is most likely an issue with Java 14.
There's a fix in Flow version 2.1.9 and 2.2.0.beta2.
Vaadin 14.1.25 still uses 2.1.8, hopefully there will be a new version with 2.1.9 soon.
Vaadin 14.2.0.beta1 uses 2.2.0.beta2, so if you want you could try that.
Hopefully the fix is available in a stable release once you need production mode to work.

Maven Nexus Issue - Authorization failed for 403 Forbidden

We have been on this issue for days now.
Created a Gitlab CI Pipeline for a Java App that reads dependencies from Maven and Nexus
The gitlab pipeline was configured to run as a nexus user with admin rights, this has been verified many times.
But, when the gitlab pipeline is executed we get the following error:
[ERROR] Failed to execute goal on project hello-component: Could not resolve dependencies for project x.y.z:hello-component:jar:1.6-SNAPSHOT: Failed to collect dependencies at a.b:c:jar:4.5.1132100: Failed to read artifact descriptor for b:c:jar:4.5.1132100: Could not transfer artifact a.b:c:pom:4.5.1132100 from/to maven-snapshots (http://host:8081/repository/maven-snapshots): Authorization failed for http://host:8081/repository/maven-snapshots/a/b/c/4.5.1132100/nidp-4.5.1132100.pom 403 Forbidden -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal on project hello-component: Could not resolve dependencies for project x.y.z:hello-component:jar:1.6-SNAPSHOT: Failed to collect dependencies at a.b:c:jar:4.5.1132100
I have also used the following guide:
https://blog.sonatype.com/how-to-use-gitlab-ci-with-nexus
My POM has the below, with env variables configured in ci/cd/settings/variables:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.5.1</version>
<executions>
<execution>
<id>default-deploy</id>
<phase>deploy</phase>
<goals>
<goal>deploy</goal>
</goals>
</execution>
</executions>
<configuration>
<serverId>maven-snapshots</serverId>
<nexusUrl>http://host:8081/repository/maven-snapshots</nexusUrl>
<skipStaging>true</skipStaging>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>maven-snapshots</id>
<url>http://host:8081/repository/maven-snapshots</url>
</repository>
<repository>
<id>maven-releases</id>
<url>http://host:8081/repository/maven-releases</url>
</repository>
<!--repository>
<id>nexus.local</id>
<url>$HOME/.m2/repository</url>
</repository-->
</repositories>
<distributionManagement>
<snapshotRepository>
<id>maven-snapshots</id>
<url>http://host:8081/repository/maven-snapshots</url>
</snapshotRepository>
<repository>
<id>maven-releases</id>
<url>http://host:8081/repository/maven-releases</url>
</repository>
</distributionManagement>
The Gitlab CI runner has the following:
image: maven:3.3.9-jdk-8
variables:
GIT_STRATEGY: clone
MAVEN_CLI_OPTS: "-s /opt/apache-maven-3.6.3/conf/settings.xml --batch-mode"
MAVEN_OPTS: "-Dmaven.repo.local=/home/gitlab-runner/.m2/repository"
cache:
paths:
- /home/gitlab-runner/.m2/repository/
- target/
stages:
- build
CodeBuild:
stage: build
script:
- /opt/apache-maven-3.6.3/bin/mvn $MAVEN_CLI_OPTS -X clean package
artifacts:
name: “x—y-component"
paths:
- ./target/x—y-component.jar
Setting.xml on gitlab ci server has the following nexus user reference:
maven-snapshots
[adminuser]
[adminpassword]
Any help will be most appreciated.
Thanks
not sure if help is still needed but it seems that You did not grant necessary privileges to role of the user which You use for deployment/resolving dependencies. Please grant role nx-repository-view---* privilege. Test it and then you can decrease scope depend on your needs.
The issue at the time was with corporate proxy blocking download from maven central etc
Edit the proxies section in your maven settings.xml, which could be located in your ~/.m2/settings.xml file.
Settings.xml also exists in your MAVEN_HOME, so ensure you are updating the correct settings.xml
<settings>
<proxies>
<proxy>
<id>httpproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>your-proxy-host</host>
<port>your-proxy-port</port>
<nonProxyHosts>add.host.that.needs.to.bypass.proxy.here|some.host.com</nonProxyHosts>
</proxy>
<proxy>
<id>httpsproxy</id>
<active>true</active>
<protocol>https</protocol>
<host>your-proxy-host</host>
<port>your-proxy-port</port>
<nonProxyHosts>add.host.that.needs.to.bypass.proxy.here|some.host.com</nonProxyHosts>
</proxy>
</proxies>
</settings>

Maven Build Failure with "mvn install" command

I was trying to generate and test my codes (if working) for Cucumber-Maven report then opened command prompt. I have tried "mvn clean", it was BUILD SUCCESS. After that, I have tried "mvn install" and encountered BUILD FAILURE (error was shown).
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.844 s
[INFO] Finished at: 2019-02-05T13:14:51+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Plugin org.apache.maven.plugins:maven-surefire-plugin:2.20 or one of its dependencies could not be resolved: Failed to read artifact descriptor for org.apache.maven.plugins:maven-surefire-plugin:jar:2.20: Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.20 from/to central (https://repo.maven.apache.org/maven2): Connect to webproxy.sample.com:8080 [webproxy.sample.com/205.165.7.13] failed: Connection timed out: connect -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
Here's my pom.xml:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20</version>
</plugin>
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>4.3.0</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>ExecuteCucumberMavenAF</projectName>
<outputDirectory>${project.build.directory}/cucumber-reports-html</outputDirectory>
<cucumberOutput>${project.build.directory}/cucumber.json</cucumberOutput>
<skippedFails>true</skippedFails>
<enableFlashCharts>true</enableFlashCharts>
<buildNumber>42</buildNumber>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
It looks like proxy issue which is blocking the downloads of dependencies, so make some changes in settings.xml or create a one if it is not there.
Goto c:\users\youruser\.m2\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">
<proxies>
<proxy>
<id>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<username>user</username> <!-- Put your username here -->
<password>pass</password> <!-- Put your password here -->
<host>123.45.6.78</host> <!-- Put the IP address of your proxy server here -->
<port>80</port> <!-- Put your proxy server's port number here -->
<nonProxyHosts>maven</nonProxyHosts> <!-- Do not use this setting unless you know what you're doing. -->
</proxy>
</proxies>
</settings>
I tried using eclipse. I used maven clean and install for the same POM file. It is working fine.
Seems there is some issue with your C:\users\youruser\.m2\settings.xml file.
May be proxy issues which is blocking maven from downloading dependencies.
Please check your settings.xml file.

maven-release-plugin and Arquillian

I have such project structure:
Parent
ProjectA
ProjectB
ProjectA produces an ear. The Arquillian based test of ProjectB depends on ear of the ProjectA (create additional deployment with ProjectA ear). Maven install goal works fine but release:prepare and release:perform are - not. The maven-release-plugin on a one of the first phases increases the version of the project. And when ProjectB constructs a deployment of ProjectA it can't find an artifact with a new version (but it exists in workspace - not in local repo):
java.lang.RuntimeException: Could not invoke deployment method: public static org.jboss.shrinkwrap.api.spec.EnterpriseArchive com.....SchemaCreationTest.createFleetEmulator()
[INFO] at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:434)
[INFO] at org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
[INFO] at org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveDependencies(DefaultRepositorySystem.java:367)
[INFO] at org.jboss.shrinkwrap.resolver.impl.maven.bootstrap.MavenRepositorySystem.resolveDependencies(MavenRepositorySystem.java:121)
[INFO] at org.jboss.shrinkwrap.resolver.impl.maven.MavenWorkingSessionImpl.resolveDependencies(MavenWorkingSessionImpl.java:228)
[INFO] at org.jboss.shrinkwrap.resolver.impl.maven.MavenStrategyStageBaseImpl.using(MavenStrategyStageBaseImpl.java:71)
[INFO] at org.jboss.shrinkwrap.resolver.impl.maven.MavenStrategyStageBaseImpl.withoutTransitivity(MavenStrategyStageBaseImpl.java:58)
[INFO] at org.jboss.shrinkwrap.resolver.impl.maven.MavenStrategyStageBaseImpl.withoutTransitivity(MavenStrategyStageBaseImpl.java:40)
I resolve artifacts with such command:
Maven.configureResolver().offline().loadPomFromFile("pom.xml").importRuntimeAndTestDependencies().resolve().withoutTransitivity().asResolvedArtifact();
P.S. mvn release:prepare works fine if I set on the dryRun option.
How can I resolve artifacts when maven release:prepare works?
Depending on how your test cases are structured, having the Arquillian tests as integration tests allow them to be executed separately.
If required, integrate the maven-failsafe-plugin:
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<parallel>methods</parallel>
<threadCount>1</threadCount>
</configuration>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.19.1</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
<plugins>...
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
Rename your test class so that its detected as an integration test. I.e. rename AcmeTest to AcmeIT, then your arquillian tests will be executed as integration tests, i.e. use mvn verify to run the arquillian tests.
This in itself doesn't resolve the problem. As a simple work around, if this is the only integration tests being executed, you can add -Darguments="-DskipITs" to your mvn release:prepare and your arquillian tests will be skipped. You can also add JUnit categories to the arquillian tests and filter at that level. More info is available on the maven-failsafe-plugin site.

Categories