Report is not generated, If I run my test cases(JUnit) through Maven? - maven

I am New to JUnit and Maven. I am running my JUnit testcases through maven. Build is getting succeed but index.html is not generated. How can I generate the index.html?
This is my project structure after build succeeded.
And My POM.xml is as follows,
<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>MyGroup</groupId>
<artifactId>TestCodeCoverage</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>MyMavenProject</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.6.3.201306030806</version>
<executions>
<execution>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<inherited>true</inherited>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.12</version>
</dependency>
</dependencies>
<configuration>
<includes>
<include>**/*.class</include>
</includes>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.8</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.41.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.41.0</version>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.opera</groupId>
<artifactId>operadriver</artifactId>
<version>1.5</version>
<exclusions>
<exclusion>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-remote-driver</artifactId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
</dependencyManagement>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.17</version>
<reportSets>
<reportSet>
<id>integration-tests</id>
<reports>
<report>failsafe-report-only</report>
</reports>
</reportSet>
</reportSets>
</plugin>
</plugins>
</reporting>
</project>

If you are expecting maven-surefire-report-plugin to generate the report, then it will do so, only if you run the site goal (mvn site). Otherwise, as you can see, the reports are available in target\surefire-reports folder.

You should navigate to the directory where you pom.xml exist.Using this command cd E:/TestProject and then run the site goal. For e.g. mvn site

Related

How to configure the maven plugins to run spock and junit5 tests

I want to run run spock and junit5 tests in the same project. So I have made an example project with nothing under src/main but two tests under src/test/java/a/package/. One of the test is a junit5 and the other one is a spock test.
But after issuing mvn test verify only the JUnit test is executed but the spock test is not. They run nicely together in Intellij via "run all tests" so there is clearly some configuration issue I can not find.
Here is my maven pom:
<?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>maven.spock.junit</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<poi.version>3.17</poi.version>
</properties>
<dependencies>
<!-- test dependencies -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.3.2</version>
<scope>test</scope>
</dependency>
<!-- spock testing framework -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>1.0-groovy-2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.4.4</version>
<scope>test</scope>
</dependency>
<!-- hamcrest matcher -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.4.3</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<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>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass></mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
<plugin>
<!-- mvn test - exclude integration tests -->
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<argLine>-Xms2g -Xmx2g -XX:MaxPermSize=500m -Dfile.encoding=UTF-8 -Duser.language=en -Duser.region=US</argLine>
<excludes>
<exclude>%regex[.*Fixme.*]</exclude>
<exclude>%regex[.*(Regression|Integration)Test.*]</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<!-- mvn verify - execute integration tests only -->
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<argLine>-Xms2g -Xmx2g -XX:MaxPermSize=500m -Dfile.encoding=UTF-8 -Duser.language=en -Duser.region=US -Duser.timezone=UTC</argLine>
<includes>
<include>%regex[.*(Regression|Integration)Test.*]</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.5</version>
<configuration>
<sources>
<source>
<directory>src/test/java</directory>
<includes>
<include>**/*.groovy</include>
</includes>
</source>
<source>
<directory>src/test/groovy</directory>
<includes>
<include>**/*.groovy</include>
</includes>
</source>
</sources>
</configuration>
<executions>
<execution>
<goals>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>skip-unit-tests</id>
<activation>
<property>
<name>skipUnitTests</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
<argLine>-Duser.timezone=UTC</argLine>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
If I use the following surefire configuration it executes the spock test but not the junit one.
<plugin>
<!-- mvn test - exclude integration tests -->
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<configuration>
<useFile>false</useFile>
<argLine>-Xms2g -Xmx2g -XX:MaxPermSize=500m -Dfile.encoding=UTF-8 -Duser.language=en -Duser.region=US</argLine>
<includes>
<include>**/*</include>
</includes>
</configuration>
</plugin>
It seems that maven gets confused with the dependencies so the junit dependencies need to go from the /project/dependencies into the surefire and failsafe plugin like so:
<?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>maven.spock.junit</groupId>
<artifactId>test</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<maven.compiler.target>${java.version}</maven.compiler.target>
<maven.compiler.source>${java.version}</maven.compiler.source>
<groovy.version>2.5.2</groovy.version>
<junit-platform.version>1.2.0</junit-platform.version>
<jupiter.version>5.2.0</jupiter.version>
<spock.version>1.2-groovy-2.5</spock.version>
</properties>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>${groovy.version}</version>
<type>pom</type> <!-- required JUST since Groovy 2.5.0 -->
</dependency>
<dependency>
<groupId>org.spockframework</groupId>
<artifactId>spock-core</artifactId>
<version>${spock.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>${jupiter.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>verify</defaultGoal>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<groupId>org.codehaus.gmavenplus</groupId>
<artifactId>gmavenplus-plugin</artifactId>
<version>1.6.1</version>
<configuration>
<testSources>
<testSource>
<directory>src/test/java</directory>
<includes>
<include>**/*.groovy</include>
</includes>
</testSource>
<testSource>
<directory>src/test/groovy</directory>
<directory>src/test</directory>
<includes>
<include>**/*.groovy</include>
</includes>
</testSource>
</testSources>
</configuration>
<executions>
<execution>
<goals>
<goal>addTestSources</goal>
<goal>generateTestStubs</goal>
<goal>compileTests</goal>
<goal>removeTestStubs</goal>
<goal>removeStubs</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junit-platform.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${jupiter.version}</version>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${jupiter.version}</version>
</dependency>
</dependencies>
<configuration>
<detail>true</detail>
<argLine>-Xms2g -Xmx2g -XX:MaxPermSize=500m -Dfile.encoding=UTF-8 -Duser.language=en -Duser.region=US</argLine>
<includes>
<include>%regex[.*]</include>
</includes>
<excludes>
<exclude>%regex[.*Fixme.*]</exclude>
<exclude>%regex[.*(Regression|Integration)Test.*]</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
<dependencies>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-surefire-provider</artifactId>
<version>${junit-platform.version}</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>${jupiter.version}</version>
</dependency>
<dependency>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
<version>${jupiter.version}</version>
</dependency>
</dependencies>
<configuration>
<argLine>-Xms2g -Xmx2g -XX:MaxPermSize=500m -Dfile.encoding=UTF-8 -Duser.language=en -Duser.region=US -Duser.timezone=UTC</argLine>
<includes>
<include>%regex[.*(Regression|Integration)Test.*]</include>
</includes>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
All the credit belong to SanderSmee - Thanks!! I was just so lucky that I have found your repo! https://github.com/SanderSmee/spock-jupiter/blob/master/pom.xml
You have to help Surefire to pick the right provider, here the surefire-junit-platform provider:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M1</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit-platform</artifactId>
<version>3.0.0-M1</version>
</dependency>
</dependencies>
</plugin>
For details see https://maven.apache.org/surefire/maven-surefire-plugin/examples/providers.html
Spock 2.0 uses Junit 5, rather than JUnit 4. So, now, it just works without any special effort to get the dependencies correct.

IntelliJ does not find pom.xml file

I'm new to this weird Maven thing and unsure how it works. My project contains a valid pom.xml file, but I am unable to do anything with it. Basically, I go to File -> Project Structure -> Libraries -> From Maven... and write pom.xml in this search field, but it does not find anything! I'm pretty sure I am doing something wrong. In general, I just want to know how to download all the libraries into a .jar format.
I use IntelliJand my pom.xml looks like this:
<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>com.corundumstudio.socketio</groupId>
<artifactId>netty-socketio</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>ConnectFour</name>
<description>A connectfour website</description>
<inceptionYear>2018</inceptionYear>
<scm>
<url>scm:git:git#github.com:mrniko/netty-socketio.git</url>
<connection>scm:git:git#github.com:mrniko/netty-socketio.git</connection>
<developerConnection>scm:git:git#github.com:mrniko/netty-socketio.git</developerConnection>
<tag>HEAD</tag>
</scm>
<licenses>
<license>
<name>Apache v2</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
<distribution>manual</distribution>
</license>
</licenses>
<developers>
<developer>
<id>mrniko</id>
<name>Nikita Koksharov</name>
<email>abracham.mitchell#gmail.com</email>
<roles>
<role>Architect</role>
<role>Developer</role>
</roles>
<timezone>+4</timezone>
</developer>
</developers>
<distributionManagement>
<repository>
<id>repo1</id>
<name>Release</name>
<url>file://C:/123</url>
</repository>
</distributionManagement>
<properties>
<skipTests>true</skipTests>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<profiles>
<profile>
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-buffer</artifactId>
<version>4.1.22.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-common</artifactId>
<version>4.1.22.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport</artifactId>
<version>4.1.22.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-handler</artifactId>
<version>4.1.22.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec-http</artifactId>
<version>4.1.22.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-codec</artifactId>
<version>4.1.22.Final</version>
</dependency>
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
<version>4.1.22.Final</version>
</dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>1.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.21</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.7.9</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.7.9.2</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>[2.5,)</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>[2.5,)</version>
<exclusions>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
<version>2.11.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.hazelcast</groupId>
<artifactId>hazelcast-client</artifactId>
<version>3.4.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongodb-driver-async</artifactId>
<version>3.6.3</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.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-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<version>2.9</version>
<configuration>
<downloadSources>true</downloadSources>
<forceRecheck>true</forceRecheck>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>pmd</goal>
<goal>cpd</goal>
</goals>
</execution>
</executions>
<configuration>
<minimumTokens>100</minimumTokens>
<targetJdk>1.8</targetJdk>
<verbose>true</verbose>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>2.11</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>checkstyle</goal>
</goals>
</execution>
</executions>
<configuration>
<consoleOutput>true</consoleOutput>
<enableRSS>false</enableRSS>
<configLocation>/checkstyle.xml</configLocation>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<optimize>true</optimize>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.0.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.1</version>
<configuration>
<argLine>-Dfile.encoding=utf-8</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.5.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Import-Package>
org.springframework.*;resolution:=optional,com.hazelcast.*;resolution:=optional,org.redisson.*;resolution:=optional,*
</Import-Package>
<Export-Package>
com.corundumstudio.socketio;version="${project.version}",
com.corundumstudio.socketio.annotation;version="${project.version}",
com.corundumstudio.socketio.listener;version="${project.version}",
com.corundumstudio.socketio.protocol;version="${project.version}",
com.corundumstudio.socketio.store;version="${project.version}",
com.corundumstudio.socketio.store.pubsub;version="${project.version}",
</Export-Package>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.6</version>
<configuration>
<basedir>${basedir}</basedir>
<header>${basedir}/header.txt</header>
<quiet>false</quiet>
<failIfMissing>true</failIfMissing>
<aggregate>false</aggregate>
<includes>
<include>src/**</include>
</includes>
<excludes>
<exclude>target/**</exclude>
</excludes>
<useDefaultExcludes>true</useDefaultExcludes>
<mapping>
<java>JAVADOC_STYLE</java>
</mapping>
<strictCheck>true</strictCheck>
<useDefaultMapping>true</useDefaultMapping>
<encoding>UTF-8</encoding>
</configuration>
<executions>
<execution>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Thank you in advance.
There are a number of things that could be going here but try this first:
Try ctrl-shift-a -> "Reimport All Maven Projects"
OR
Views -> Tool Windows -> Maven Projects -> click top left button (looks like a refresh icon)
First of all be sure that your project it is using Maven ?! maybe it is using Gradle so on
For a Maven project, pom.xml file:
For a Gradle project, build.gradle file:
Alternatives to Apache Maven. Jira, Jenkins, Gradle, Apache Ant, and Apache Tomcat

Cannot attach spring cloud contract maven plugin to lifecycle phase

I could not manage to run spring-cloud-contract:generateTests to run without explicitly specifying the goal in maven command line. Here is the plugin configuration of pom.xml:
<!-- Contract Driven Testing -->
<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-maven-plugin</artifactId>
<version>${spring-cloud-contract.version}</version>
<!-- Don't forget about this value !! -->
<extensions>true</extensions>
<configuration>
<!-- Provide the base class for your auto-generated tests -->
<packageWithBaseClasses>cdc</packageWithBaseClasses>
</configuration>
<executions>
<execution>
<id>spring-cloud-generateTests</id>
<goals>
<goal>generateTests</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-verifier</artifactId>
<version>${spring-cloud-contract.version}</version>
</dependency>
</dependencies>
</plugin>
When I run mvn clean install the tests are not generated, although explicitly specifying the goal fulfills the goal.
Here is the full pom.xml:
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.RELEASE</version>
</parent>
<groupId>tr.gov.tubitak.bilgem.yte.maliye</groupId>
<artifactId>maliye-muhasebeislemleri</artifactId>
<packaging>jar</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>maliye-muhasebeislemleri Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Database Dependencies -->
<h2.version>1.4.190</h2.version>
<!-- Testing Dependencies -->
<postgresql.version>9.4.1207</postgresql.version>
<start-class>tr.gov.tubitak.bilgem.yte.maliye.Application</start-class>
<spring-cloud-contract.version>1.0.4.BUILD-SNAPSHOT</spring-cloud-contract.version>
</properties>
<distributionManagement>
<repository>
<id>nexus</id>
<name>Internal Releases</name>
<url>http://yte-nexus:8081/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>nexus</id>
<name>Internal Releases</name>
<url>http://yte-nexus:8081/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
<dependencyManagement>
<dependencies>
<!-- If you're adding this dependency explicitly you have to add it *BEFORE*
the Release Train BOM -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-dependencies</artifactId>
<version>${spring-cloud-contract.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Testing Dependencies -->
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
<version>1.6.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jmockit</groupId>
<artifactId>jmockit</artifactId>
<version>1.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>tr.gov.tubitak.bilgem.yte.maliye</groupId>
<artifactId>mb-testutils</artifactId>
<version>0.1.6-RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-contract-verifier</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-wiremock</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-contract-stub-runner</artifactId>
<scope>test</scope>
</dependency>
<!-- Required by contract tests -->
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-model</artifactId>
<version>3.3.9</version>
<scope>test</scope>
</dependency>
<!-- MGM-CORE Dependencies -->
<dependency>
<groupId>tr.gov.tubitak.bilgem.yte.maliye</groupId>
<artifactId>mb-core</artifactId>
<version>0.10.2-RELEASE</version>
</dependency>
<!-- Database Dependencies -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<version>${h2.version}</version>
<scope>test</scope>
</dependency>
<!-- POSTGRES -->
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.6.201602180812</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<finalName>maliye-muhasebeislemleri</finalName>
<resources>
<resource>
<directory>${basedir}/src/main/java</directory>
</resource>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<testResources>
<testResource>
<directory>${project.basedir}/src/test/java</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
<testResource>
<directory>${project.basedir}/src/test/resources</directory>
</testResource>
<testResource>
<directory>${project.basedir}/target/generated-test-sources</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</testResource>
</testResources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>springloaded</artifactId>
<version>${spring-loaded.version}</version>
</dependency>
</dependencies>
<configuration>
<mainClass>${start-class}</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>tr.gov.tubitak.bilgem.yte.maliye</groupId>
<artifactId>mb-automatic-file-creator</artifactId>
<version>0.0.1-RELEASE</version>
<dependencies>
<dependency>
<groupId>tr.gov.tubitak.bilgem.yte.maliye</groupId>
<artifactId>mb-automatic-file-creator</artifactId>
<version>0.0.1-RELEASE</version>
</dependency>
</dependencies>
<configuration>
<fName>${packageName}</fName>
<directory>${directory}</directory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
<plugin>
<groupId>tr.gov.tubitak.bilgem.yte.maliye</groupId>
<artifactId>mb-veriaktarim-maven-plugin</artifactId>
<version>0.2.8-SNAPSHOT</version>
<configuration>
<driver>${db.driver}</driver>
<datasetDir>db-changelog/veri/</datasetDir>
<jdbcUrl>${db.url}</jdbcUrl>
<dbUser>${db.username}</dbUser>
<dbPass>${db.password}</dbPass>
<schema>${db.schema}</schema>
<ignoredTables>
<table>databasechangelog</table>
<table>databasechangeloglock</table>
<table>cerceve_hesap_kodu</table>
<table>hesap_grubu</table>
</ignoredTables>
<noTruncateTables>
<table>kamu_idaresi</table>
<table>harcama_birimi</table>
<table>muhasebe_birimi</table>
<table>muhasebe_fisi</table>
<table>ortak_hesap_plani</table>
<table>ortak_hesap_kodu</table>
<table>kurum_hesap_plani</table>
<table>kurum_hesap_kodu</table>
<table>son_fis_bilgisi</table>
<table>harcama_birimi_devir_bilgisi</table>
<table>kurum_hesap_plani_devir_bakiye_bilgisi</table>
<table>kurum_hesap_kodu_devir_bakiye_bilgisi</table>
<table>ortak_hesap_kodu_grubu_kod</table>
<table>ortak_hesap_kodu_grubu</table>
<table>ortak_hesap_kodu_iliskisi</table>
</noTruncateTables>
</configuration>
<dependencies>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
<version>${postgresql.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>cleanAndTransferData</id>
<phase>prepare-package</phase>
<goals>
<goal>cleanAndTransferData</goal>
</goals>
</execution>
<execution>
<id>exportData</id>
<phase>prepare-package</phase>
<goals>
<goal>exportData</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<configuration>
<properties>
<argLine>-Dfile.encoding=UTF-8</argLine>
</properties>
<includes>
<include>**/*Tests.java</include>
<include>**/*Test.java</include>
<include>**/Test*.java</include>
</includes>
<excludes>
<exclude>**/Abstract*.java</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-maven-plugin</artifactId>
<version>3.3.2</version>
<configuration>
<promptOnNonLocalDatabase>false</promptOnNonLocalDatabase>
<changeLogFile>db-changelog/db.changelog-master.xml</changeLogFile>
<driver>${db.driver}</driver>
<url>${db.url}</url>
<username>${db.username}</username>
<password>${db.password}</password>
<defaultSchemaName>${db.schema}</defaultSchemaName>
<contexts>${db.context}</contexts>
<migrationSqlOutputFile>db-setting/muhasebe.sql</migrationSqlOutputFile>
</configuration>
<executions>
<execution>
<phase>process-resources</phase>
<goals>
<goal>update</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- JACOCO -->
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.7.6.201602180812</version>
<configuration>
<sourceEncoding>UTF-8</sourceEncoding>
<outputEncoding>UTF-8</outputEncoding>
</configuration>
<executions>
<execution>
<id>jacoco-prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>jacoco-prepare-package</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- JACOCO -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.14</version>
<executions>
<execution>
<id>integration-test</id>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>tr.gov.tubitak.bilgem.yte.maliye</groupId>
<artifactId>maliye-kullaniciaktarim-maven-plugin</artifactId>
<version>0.2.2-RELEASE</version>
<configuration>
<securityUrl>${kullaniciAktarim.url}</securityUrl>
<mnemonicCode>MHS</mnemonicCode>
<clientServicePath>${kullaniciAktarim.istemciUrl}</clientServicePath>
<serviceName>muhasebe_islemleri</serviceName>
<userRoleFile>src/main/resources/security/UserRole.xml</userRoleFile>
<rolePermissionFile>src/main/resources/security/RolePermission.xml</rolePermissionFile>
<sqlOutFile>db-setting/kullanici.sql</sqlOutFile>
</configuration>
</plugin>
<!-- Contract Driven Testing -->
<plugin>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-maven-plugin</artifactId>
<version>${spring-cloud-contract.version}</version>
<!-- Don't forget about this value !! -->
<extensions>true</extensions>
<configuration>
<!-- Provide the base class for your auto-generated tests -->
<packageWithBaseClasses>cdc</packageWithBaseClasses>
</configuration>
<executions>
<execution>
<id>spring-cloud-generateTests</id>
<phase>compile</phase>
<goals>
<goal>generateTests</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-contract-verifier</artifactId>
<version>${spring-cloud-contract.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
<profiles>
<profile>
<id>development</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<properties>
<spring.profiles.active>development</spring.profiles.active>
<build.profile.id>dev</build.profile.id>
<db.url>jdbc:postgresql://localhost:5432/maliye_muhasebeislemleri</db.url>
<db.driver>org.postgresql.Driver</db.driver>
<db.username>maliye_muhasebeislemleri</db.username>
<db.password>Aa123456</db.password>
<db.schema>public</db.schema>
<db.context>development</db.context>
<kullaniciAktarim.url>http://localhost:8080/maliye-kullanici/kullanici/kullanicilariGuncelle</kullaniciAktarim.url>
<kullaniciAktarim.istemciUrl>http://localhost:8080/muhasebe</kullaniciAktarim.istemciUrl>
</properties>
</profile>
<profile>
<id>test</id>
<properties>
<spring.profiles.active>test</spring.profiles.active>
<build.profile.id>test</build.profile.id>
<db.url>jdbc:postgresql://mgm-01:5432/maliye?current=maliye_muhasebeislemleri</db.url>
<db.driver>org.postgresql.Driver</db.driver>
<db.username>maliye_muhasebeislemleri</db.username>
<db.password>Aa123456</db.password>
<db.schema>maliye_muhasebeislemleri</db.schema>
<db.context>test</db.context>
<kullaniciAktarim.url>http://mgm-10:8080/maliye-kullanici/kullanici/kullanicilariGuncelle</kullaniciAktarim.url>
<kullaniciAktarim.istemciUrl>http://mgm-09:80/muhasebe</kullaniciAktarim.istemciUrl>
</properties>
</profile>
</profiles>
I tried to run your example but it fails to compile due to missing dependencies. Anyways what #khmarbaise said is perfectly valid. With Maven you have to set a plugin in the <build><plugins> section. If you have it only in the <pluginManagement> section then it won't work. You can check out the Spring Cloud Contract Samples where everything works fine and is well setup - https://github.com/spring-cloud-samples/spring-cloud-contract-samples/blob/master/producer/pom.xml#L73-L103

Cannot run maven install for osmdroid

I have checked out osmdroid project and was trying to run "maven install", however; I run into this error every time.
Failed to execute goal com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0:generate-sources (default-generate-sources) on project OpenStreetMapViewer: The plugin com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0 requires Maven version 3.1.1
and shows this error hint beside the code:
Plugin execution not covered by lifecycle configuration: com.jayway.maven.plugins.android.generation2:android-maven-plugin:
3.8.0:consume-aar (execution: default-consume-aar, phase: compile)
Here is my POM:
<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>
<parent>
<groupId>org.sonatype.oss</groupId>
<artifactId>oss-parent</artifactId>
<version>7</version>
</parent>
<groupId>org.osmdroid</groupId>
<artifactId>osmdroid-parent</artifactId>
<version>4.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>OSMdroid parent</name>
<description>An Android library to display OpenStreetMap views.</description>
<url>http://code.google.com/p/osmdroid</url>
<licenses>
<license>
<name>Apache License 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0</url>
<distribution>repo</distribution>
</license>
</licenses>
<scm>
<url>http://osmdroid.googlecode.com/svn/trunk</url>
<connection>scm:svn:http://osmdroid.googlecode.com/svn/trunk</connection>
<developerConnection>scm:svn:https://osmdroid.googlecode.com/svn/trunk</developerConnection>
</scm>
<issueManagement>
<system>Google Project</system>
<url>http://code.google.com/p/osmdroid/issues/list</url>
</issueManagement>
<developers>
<!-- TODO -->
<developer>
<id>id</id>
<name>name</name>
<roles>
<role>developer</role>
<role>contributor</role>
<role>...</role>
</roles>
</developer>
</developers>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencyManagement>
<dependencies>
<!-- Android included libraries -->
<dependency>
<groupId>com.google.android</groupId>
<artifactId>android</artifactId>
<version>4.1.1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android</groupId>
<artifactId>support-v4</artifactId>
<version>r7</version>
</dependency>
<dependency>
<groupId>com.google.android.maps</groupId>
<artifactId>maps</artifactId>
<version>16_r3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>google-play-services</artifactId>
<type>apklib</type>
<version>10</version>
</dependency>
<dependency>
<groupId>com.google.android.gms</groupId>
<artifactId>google-play-services</artifactId>
<type>jar</type>
<version>10</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20070829</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.0.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.james</groupId>
<artifactId>apache-mime4j</artifactId>
<version>0.6</version>
<scope>provided</scope>
</dependency>
<!-- -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-android</artifactId>
<version>1.6.1-RC1</version>
</dependency>
<!-- test dependencies -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<sdk>
<platform>16</platform>
</sdk>
</configuration>
<extensions>true</extensions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<phase>package</phase>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.9.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>1.4</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<version>1.2</version>
</plugin>
</plugins>
</pluginManagement>
</build>
<modules>
<module>osmdroid-android</module>
<module>osmdroid-third-party</module>
<module>OpenStreetMapViewer</module>
<module>GoogleWrapperSample</module>
<module>OSMMapTilePackager</module>
</modules>
<profiles>
<profile>
<!-- this profile is activated when using 'mvn release:perform' -->
<!-- it signs artifacts before staging to Sonatype -->
<id>release-sign-artifacts</id>
<activation>
<property>
<name>performRelease</name>
<value>true</value>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<phase>verify</phase>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jarsigner-plugin</artifactId>
<executions>
<execution>
<id>signing</id>
<goals>
<goal>sign</goal>
</goals>
<phase>package</phase>
<inherited>true</inherited>
<configuration>
<archiveDirectory />
<includes>
<include>target/*.apk</include>
</includes>
<keystore>${sign.keystore}</keystore>
<storepass>${sign.storepass}</storepass>
<keypass>${sign.keypass}</keypass>
<alias>${sign.alias}</alias>
<arguments>
<argument>-sigalg</argument>
<argument>MD5withRSA</argument>
<argument>-digestalg</argument>
<argument>SHA1</argument>
</arguments>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.jayway.maven.plugins.android.generation2</groupId>
<artifactId>android-maven-plugin</artifactId>
<inherited>true</inherited>
<executions>
<execution>
<id>alignApk</id>
<phase>install</phase>
<goals>
<goal>zipalign</goal>
</goals>
</execution>
</executions>
<configuration>
<zipalign>
<verbose>true</verbose>
<skip>false</skip>
</zipalign>
<sign>
<debug>false</debug>
</sign>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
The plugin
com.jayway.maven.plugins.android.generation2:android-maven-plugin:3.8.0
requires Maven version 3.1.1
Are you sure you have the latest version of Maven installed (>= 3.1.1)?
I managed to build the project by using an older version of "com.jayway.maven.plugins.android.generation2" plugin..
A version that doesn't require maven 3.1.1

Error thrown on running pom.xml+ testng=selenium: failed to execute goal

I've thrown with an error and I tried with mulitple options on the testng reading,could someone show me the correct way of setting the goal or exectuion on xml or is this is due to surfire plugin.
With the way it shows I figured it could be something on execution goals.some help??
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.15:test (default-test) on project pams: A type incompatibility occured while executing org.apache.maven.plugins:maven-surefire-plugin:2.15:test: java.io.File cannot be cast to java.lang.Class
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-surefire-plugin:2.15
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
Here is the pom.xml I've been using,
<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>xxx</groupId>
<artifactId>xxx</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>xxx</name>
<dependencies>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>2.3</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.3</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.15</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.3.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.33.0</version>
</dependency>
</dependencies>
<build>
<testSourceDirectory>${basedir}/src/test/com</testSourceDirectory>
<outputDirectory>${basedir}/target/classes</outputDirectory>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>selenium-maven-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<phase>pre-integration-test</phase>
<goals>
<goal>start-server</goal>
</goals>
<configuration>
<background>true</background>
</configuration>
</execution>
<execution>
<id>stop-selenium</id>
<phase>post-integration-test</phase>
<goals>
<goal>stop-server</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<configuration>
<forkCount>3</forkCount>
<reuseForks>true</reuseForks>
<parallel>methods</parallel>
<threadCount>10</threadCount>
<suiteXmlFiles>
<suiteXmlFile>${basedir}/testng.xml</suiteXmlFile>
</suiteXmlFiles>
<!-- <suiteXmlFiles> -->
<!-- <suiteXmlFile>${basedir}/testsuite-persistence-layer.xml</suiteXmlFile> -->
<!-- </suiteXmlFiles> -->
<!-- <skipTests>false</skipTests> -->
<!-- <systemPropertyVariables> -->
<!-- <propertyName>firefox</propertyName> -->
<!-- </systemPropertyVariables> -->
</configuration>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
It's surefire plugin: I tried your pom and (with some dummy contents for testng.xml) had the same issue. When reverted to v2.14, surefire plugin doesn't throw this error and proceeds to the tests.

Resources