I am trying to get my first AspectJ aspect running. Setup looks ok to me, following the documentation I can find. e.g.
developers site: https://github.com/kriegaex/org.aspectj
set up instructions: https://github.com/eclipse/org.aspectj/blob/master/docs/developer/IDE.md
join point examples: https://www.eclipse.org/aspectj/doc/released/progguide/language-joinPoints.html
But no aspect will fire, no matter what options I have tried during all today.
I believe the pointcuts is correctly pointing to my method call because I was getting the error about pointcuts not being used when I changed it. (Thats not happening now - dont know what I did :-())
So is the problem in the setup? The pointcuts? How do you go about de-bugging such a situation? Am I missing something in the docs?
POM
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.14.0</version>
<!--
<groupId>dev.aspectj</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.13.2-SNAPSHOT</version>
-->
<executions>
<execution>
<goals>
<goal>compile</goal> <!-- use this goal to weave all your main classes -->
<goal>test-compile</goal> <!-- use this goal to weave all your test classes -->
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.9.7</version>
</dependency>
</dependencies>
<configuration>
<showWeaveInfo>true</showWeaveInfo>
<forceAjcCompile>true</forceAjcCompile>
<sources/>
<weaveDirectories>
<weaveDirectory>${project.build.directory}/classes</weaveDirectory>
</weaveDirectories>
<complianceLevel>11</complianceLevel>
<source>11</source>
<target>11</target>
<verbose>true</verbose>
<Xlint>warning</Xlint>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
.....
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>RELEASE</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.22</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.6.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>22.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/dev.aspectj/aspectj-maven-plugin -->
<dependency>
<groupId>dev.aspectj</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>1.13.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.aspectj/aspectjrt -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.9.7</version>
<scope>runtime</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.9.7</version>
<scope>runtime</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.aspectj/aspectjtools -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>1.9.7</version>
</dependency>
</dependencies>
ASPECT
public aspect MdDOMAINChildAspect {
pointcut myExceptionHandlerPointcut(): execution(void mdDOMAIN.MdDOMAINInstance.testCall() );
before(): myExceptionHandlerPointcut() {
System.out.println("-------------- Aspect Advice Logic ---------------");
}
CLASS
#Data
public class MdDOMAINInstance {
#MdDOMAINChildAnnotation(selectName = "Indicators")
public MdDOMAINInstance selectFilingIndicators() throws NoSuchMethodException {
testCall();
Method m=this.getClass().getMethod("selectFilingIndicators");
MdDOMAINChildAnnotation metaidAnnotation=m.getAnnotation(MdDOMAINChildAnnotation.class);
System.out.println("Annotation: " + metaidAnnotation.selectName());
return this;
}
public void testCall()
{
System.out.println("In testCall()");
return ;
}
}
TEST
class MdDOMAINInstanceTest {
#Test
void selectFilingIndicatorsTest() throws NoSuchMethodException {
MdDOMAINInstance mdDOMAINInstance = new MdDOMAINInstance().selectFilingIndicators();
}
}
MAVEN TEST RUN
clean test -Dtest=MdDOMAINInstanceTest -f pom.xml
MAVEN TEST RUN OUTCOME
"C:\Program Files\Java\jdk-11.0.12\bin\java.exe" -Dmaven.multiModuleProjectDirectory=....IdeaProjects\us-MYROOT-DOMAIN-004 "-Dmaven.home=C:\Program Files\JetBrains\IntelliJ IDEA 2020.1\plugins\maven\lib\maven3" "-Dclassworlds.conf=C:\Program Files\JetBrains\IntelliJ IDEA 2020.1\plugins\maven\lib\maven3\bin\m2.conf" "-Dmaven.ext.class.path=C:\Program Files\JetBrains\IntelliJ IDEA 2020.1\plugins\maven\lib\maven-event-listener.jar" "-javaagent:C:\Program Files\JetBrains\IntelliJ IDEA 2020.1\lib\idea_rt.jar=52349:C:\Program Files\JetBrains\IntelliJ IDEA 2020.1\bin" -Dfile.encoding=UTF-8 -classpath "C:\Program Files\JetBrains\IntelliJ IDEA 2020.1\plugins\maven\lib\maven3\boot\plexus-classworlds-2.6.0.jar;C:\Program Files\JetBrains\IntelliJ IDEA 2020.1\plugins\maven\lib\maven3\boot\plexus-classworlds.license" org.codehaus.classworlds.Launcher -Didea.version=2021.3.2 clean test -Dtest=MdDOMAINInstanceTest
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for us-MYROOT:us-MYROOT-DOMAIN-004:jar:1.0-SNAPSHOT
[WARNING] 'dependencies.dependency.version' for org.junit.jupiter:junit-jupiter:jar is either LATEST or RELEASE (both of them are being deprecated) # line 117, column 22
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. # line 20, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] --------------< us-MYROOT:us-MYROOT-DOMAIN-004 >--------------
[INFO] Building us-MYROOT-DOMAIN-004 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # us-MYROOT-DOMAIN-004 ---
[INFO] Deleting .....IdeaProjects\us-MYROOT-DOMAIN-004\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # us-MYROOT-DOMAIN-004 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # us-MYROOT-DOMAIN-004 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 3 source files to .....IdeaProjects\us-MYROOT-DOMAIN-004\target\classes
[INFO]
[INFO] --- aspectj-maven-plugin:1.14.0:compile (default) # us-MYROOT-DOMAIN-004 ---
[INFO] Showing AJC message detail for messages of types: [error, warning, fail]
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # us-MYROOT-DOMAIN-004 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # us-MYROOT-DOMAIN-004 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to .....IdeaProjects\us-MYROOT-DOMAIN-004\target\test-classes
[INFO]
[INFO] --- aspectj-maven-plugin:1.14.0:test-compile (default) # us-MYROOT-DOMAIN-004 ---
[INFO] Showing AJC message detail for messages of types: [error, warning, fail]
[WARNING] You aren't using a compiler supported by lombok, so lombok will not work and has been disabled.
Your processor is: org.aspectj.org.eclipse.jdt.internal.compiler.apt.dispatch.BatchProcessingEnvImpl
Lombok supports: OpenJDK javac, ECJ
<unknown source file>:<no line information>
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) # us-MYROOT-DOMAIN-004 ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO] Running mdDOMAIN.MdDOMAINInstanceTest
In testCall()
Annotation: Indicators
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.065 s - in mdDOMAIN.MdDOMAINInstanceTest
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 22.238 s
[INFO] Finished at: 2022-10-21T20:14:46+11:00
[INFO] ------------------------------------------------------------------------
Process finished with exit code 0
Have you tried without Lombok in order to avoid this problem? Try doing manually in your test class what the Lombok annotation does instead.
After we have established that this solves the problem, we can start looking into possible workarounds. If this really is your first AspectJ problem, you should not start with a difficult mix like AspectJ + Lombok.
Besides, if your #Data class is immutable, you might not need Lombok at all and could use a recent Java version and native Java records for that.
Related
It is an IBM MQ challenge and I have applied the provided instructions, however, I faced the ClassNotFound exception after the project is built using maven.
I noticed the following line in the result of mvn clean package command
[WARNING] JAR will be empty - no content was marked for inclusion!
POM.XML
<?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>com.ibm.mq</groupId>
<artifactId>TicketGenerator</artifactId>
<version>1.4</version>
<name>mq-dev-badge-sample</name>
<url>https://github.com/ibm-messaging/mq-dev-badge-sample</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.ibm.mq/com.ibm.mq.allclient -->
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>com.ibm.mq.allclient</artifactId>
<version>9.3.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/javax.jms/javax.jms-api -->
<dependency>
<groupId>javax.jms</groupId>
<artifactId>javax.jms-api</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>3.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.glassfish.jaxb/jaxb-core -->
<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-core</artifactId>
<version>3.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-impl -->
<dependency>
<groupId>com.sun.xml.bind</groupId>
<artifactId>jaxb-impl</artifactId>
<version>3.0.0</version>
<scope>runtime</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/com.sun.istack/istack-commons-runtime -->
<dependency>
<groupId>com.sun.istack</groupId>
<artifactId>istack-commons-runtime</artifactId>
<version>4.0.1</version>
</dependency>
<!-- https://mvnrepository.com/artifact/jakarta.activation/jakarta.activation-api -->
<dependency>
<groupId>jakarta.activation</groupId>
<artifactId>jakarta.activation-api</artifactId>
<version>2.0.1</version>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle -->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging -->
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.5.2</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.8.2</version>
</plugin>
<!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle -->
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.7.1</version>
</plugin>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>3.0.0</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.ibm.mq.badge.Manager</mainClass>
</transformer>
</transformers>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Result of mvn clean package:
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< com.ibm.mq:TicketGenerator >---------------------
[INFO] Building mq-dev-badge-sample 1.4
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) # TicketGenerator ---
[INFO] Deleting E:\MQClient\mq-dev-badge-sample-master\MQTicketService\TicketGenerator\target
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) # TicketGenerator ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\MQClient\mq-dev-badge-sample-master\MQTicketService\TicketGenerator\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # TicketGenerator ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) # TicketGenerator ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\MQClient\mq-dev-badge-sample-master\MQTicketService\TicketGenerator\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # TicketGenerator ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-test) # TicketGenerator ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:3.0.2:jar (default-jar) # TicketGenerator ---
[WARNING] JAR will be empty - no content was marked for inclusion!
[INFO] Building jar: E:\MQClient\mq-dev-badge-sample-master\MQTicketService\TicketGenerator\target\TicketGenerator-1.4.jar
[INFO]
[INFO] --- maven-shade-plugin:3.2.4:shade (default) # TicketGenerator ---
[INFO] Including com.ibm.mq:com.ibm.mq.allclient:jar:9.3.0.0 in the shaded jar.
[INFO] Including org.bouncycastle:bcprov-jdk15to18:jar:1.71 in the shaded jar.
[INFO] Including org.bouncycastle:bcpkix-jdk15to18:jar:1.71 in the shaded jar.
[INFO] Including org.bouncycastle:bcutil-jdk15to18:jar:1.71 in the shaded jar.
[INFO] Including org.json:json:jar:20220320 in the shaded jar.
[INFO] Including javax.jms:javax.jms-api:jar:2.0.1 in the shaded jar.
[INFO] Including jakarta.xml.bind:jakarta.xml.bind-api:jar:3.0.0 in the shaded jar.
[INFO] Including com.sun.activation:jakarta.activation:jar:2.0.0 in the shaded jar.
[INFO] Including org.glassfish.jaxb:jaxb-core:jar:3.0.0 in the shaded jar.
[INFO] Including org.glassfish.jaxb:txw2:jar:3.0.0 in the shaded jar.
[INFO] Including com.sun.xml.bind:jaxb-impl:jar:3.0.0 in the shaded jar.
[INFO] Including com.sun.xml.bind:jaxb-core:jar:3.0.0 in the shaded jar.
[INFO] Including com.sun.istack:istack-commons-runtime:jar:4.0.1 in the shaded jar.
[INFO] Including jakarta.activation:jakarta.activation-api:jar:2.0.1 in the shaded jar.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] Discovered module-info.class. Shading will break its strong encapsulation.
[WARNING] TicketGenerator-1.4.jar, bcpkix-jdk15to18-1.71.jar, bcprov-jdk15to18-1.71.jar, bcutil-jdk15to18-1.71.jar, com.ibm.mq.allclient-9.3.0.0.jar, istack-commons-runtime-4.0.1.jar, jakarta.activation-2.0.0.jar, jakarta.activation-api-2.0.1.jar, jakarta.xml.bind-api-3.0.0.jar, javax.jms-api-2.0.1.jar, jaxb-core-3.0.0.jar, jaxb-core-3.0.0.jar, jaxb-impl-3.0.0.jar, json-20220320.jar, txw2-3.0.0.jar define 1 overlapping resource:
[WARNING] - META-INF/MANIFEST.MF
[WARNING] istack-commons-runtime-4.0.1.jar, jakarta.activation-2.0.0.jar, jakarta.activation-api-2.0.1.jar, jakarta.xml.bind-api-3.0.0.jar, jaxb-core-3.0.0.jar, jaxb-core-3.0.0.jar, jaxb-impl-3.0.0.jar, txw2-3.0.0.jar define 2 overlapping resources:
[WARNING] - META-INF/LICENSE.md
[WARNING] - META-INF/NOTICE.md
[WARNING] jakarta.activation-2.0.0.jar, jakarta.activation-api-2.0.1.jar define 31 overlapping classes:
[WARNING] - jakarta.activation.ActivationDataFlavor
[WARNING] - jakarta.activation.CommandInfo
[WARNING] - jakarta.activation.CommandInfo$Beans
[WARNING] - jakarta.activation.CommandInfo$Beans$1
[WARNING] - jakarta.activation.CommandMap
[WARNING] - jakarta.activation.CommandObject
[WARNING] - jakarta.activation.DataContentHandler
[WARNING] - jakarta.activation.DataContentHandlerFactory
[WARNING] - jakarta.activation.DataHandler
[WARNING] - jakarta.activation.DataHandler$1
[WARNING] - 21 more...
[WARNING] jaxb-core-3.0.0.jar, jaxb-core-3.0.0.jar define 128 overlapping classes and resources:
[WARNING] - META-INF.versions.9.org.glassfish.jaxb.core.StackHelper
[WARNING] - META-INF/maven/org.glassfish.jaxb/jaxb-core/pom.properties
[WARNING] - META-INF/maven/org.glassfish.jaxb/jaxb-core/pom.xml
[WARNING] - org.glassfish.jaxb.core.Locatable
[WARNING] - org.glassfish.jaxb.core.StackHelper
[WARNING] - org.glassfish.jaxb.core.Utils
[WARNING] - org.glassfish.jaxb.core.WhiteSpaceProcessor
[WARNING] - org.glassfish.jaxb.core.annotation.OverrideAnnotationOf
[WARNING] - org.glassfish.jaxb.core.annotation.XmlIsSet
[WARNING] - org.glassfish.jaxb.core.annotation.XmlLocation
[WARNING] - 118 more...
[WARNING] jaxb-core-3.0.0.jar, txw2-3.0.0.jar define 55 overlapping classes and resources:
[WARNING] - META-INF/maven/org.glassfish.jaxb/txw2/pom.properties
[WARNING] - META-INF/maven/org.glassfish.jaxb/txw2/pom.xml
[WARNING] - com.sun.xml.txw2.Attribute
[WARNING] - com.sun.xml.txw2.Cdata
[WARNING] - com.sun.xml.txw2.Comment
[WARNING] - com.sun.xml.txw2.ContainerElement
[WARNING] - com.sun.xml.txw2.Content
[WARNING] - com.sun.xml.txw2.ContentVisitor
[WARNING] - com.sun.xml.txw2.DatatypeWriter
[WARNING] - com.sun.xml.txw2.DatatypeWriter$1
[WARNING] - 45 more...
[WARNING] istack-commons-runtime-4.0.1.jar, jaxb-core-3.0.0.jar define 25 overlapping classes and resources:
[WARNING] - META-INF.versions.9.com.sun.istack.logging.StackHelper
[WARNING] - META-INF/maven/com.sun.istack/istack-commons-runtime/pom.properties
[WARNING] - META-INF/maven/com.sun.istack/istack-commons-runtime/pom.xml
[WARNING] - com.sun.istack.Builder
[WARNING] - com.sun.istack.ByteArrayDataSource
[WARNING] - com.sun.istack.FinalArrayList
[WARNING] - com.sun.istack.FragmentContentHandler
[WARNING] - com.sun.istack.Interned
[WARNING] - com.sun.istack.NotNull
[WARNING] - com.sun.istack.Nullable
[WARNING] - 15 more...
[WARNING] maven-shade-plugin has detected that some class files are
[WARNING] present in two or more JARs. When this happens, only one
[WARNING] single version of the class is copied to the uber jar.
[WARNING] Usually this is not harmful and you can skip these warnings,
[WARNING] otherwise try to manually exclude artifacts based on
[WARNING] mvn dependency:tree -Ddetail=true and the above output.
[WARNING] See http://maven.apache.org/plugins/maven-shade-plugin/
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing E:\MQClient\mq-dev-badge-sample-master\MQTicketService\TicketGenerator\target\TicketGenerator-1.4.jar with E:\MQClient\mq-dev-badge-sample-master\MQTicketService\TicketGenerator\target\TicketGenerator-1.4-shaded.jar
[INFO] Dependency-reduced POM written at: E:\MQClient\mq-dev-badge-sample-master\MQTicketService\TicketGenerator\dependency-reduced-pom.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.547 s
[INFO] Finished at: 2022-08-12T00:20:42+03:00
[INFO] ------------------------------------------------------------------------
Result of IBM Instructed java -cp target\TicketGenerator-1.4.jar; com.ibm.mq.badge.Manager
Error: Could not find or load main class com.ibm.mq.badge.Manager
Caused by: java.lang.ClassNotFoundException: com.ibm.mq.badge.Manager
Please advise folks
As suggested by #slindenau, I removed the link files and moved the com folder into src/main/java and run mvn and the JAR file is build successfully and java application worked fine.
I am trying to run a maven test for the following pom. But no tests re getting picked up. Though in the maven tests its showing that the test is being compiled. I am using JUnit 4.12. I tried several things and found out that the parent pom is causing the issues. If I remove the parent pom and give its own group id and artifact Id it's working.
Can some please explain to me why it's not working with the parent pom and provide a solution for it.
<parent>
<groupId>com.test</groupId>
<artifactId>test-parent</artifactId>
<version>20.6.0</version>
</parent>
<artifactId>ai_one_click</artifactId>
<name>one_click</name>
<packaging>jar</packaging>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.test</groupId>
<artifactId>data_model</artifactId>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
<version>2.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
<version>2.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<version>2.23.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.1</version>
<executions>
<execution>
<configuration>
<includes> <include>**/Test1.java</include> </includes>
</configuration>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
[INFO] --- maven-clean-plugin:3.1.0:clean (default-clean) # ai_one_click ---
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-cli) # ai_one_click ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to one_click\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.22.1:test (default-cli) # ai_one_click ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
I tried with various maven commands
clean surefire:test
clean test
clean -D maven.test.failure.ignore=true compiler:testCompile surefire:test
test -Dtest=Test1
I'm aware that there are multiple threads going around in regards to this I have tried for up to 3 hours so I apologise for the repetition.
All I want to do is run mvn test to have it run the Junit 5 Tests. Pressing Run on IntelliJ works but mvn test in the terminal does not.
File structure is below -
https://user-images.githubusercontent.com/37623164/64642711-53cf1d80-d452-11e9-9764-849d73fcc5c9.png
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.1.8.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.petrego</groupId>
<artifactId>PetRego</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>PetRego</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter</artifactId>
<version>5.4.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-commons</artifactId>
<version>1.4.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.22.0</version>
</plugin>
</plugins>
</build>
</project>
Returned Result in Logs -
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< com.petrego:PetRego >-------------------------
[INFO] Building PetRego 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:resources (default-resources) # PetRego ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) # PetRego ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.1.0:testResources (default-testResources) # PetRego ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /Users/639603/projects/PetRego/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) # PetRego ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) # PetRego ---
[INFO]
[INFO] -------------------------------------------------------
[INFO] T E S T S
[INFO] -------------------------------------------------------
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.704 s
[INFO] Finished at: 2019-09-11T05:02:30+10:00
[INFO] ------------------------------------------------------------------------
In general, the first thing you should do is check if there are newer versions of plugins.
Upgrading surefire should fix your issue, see https://maven.apache.org/surefire/maven-surefire-plugin/
As #AKSW suggested in the questions there is an incorrect import.
I was importing org.junit.Test (Junit4) when I should been importing JUnit5 org.junit.jupiter.api.Test (JUnit5)
I have written a spring boot application. I have written Junit test cases as well for that. When i run mvn clean install command, test cases are not running as part of that mvn build. But when i just right click and run as Junit test case all my test cases execute. I believe there is some configuration error.
Am using spring-boot, maven as build and Eclipse ide.
My test class name is TestService.java and it is in src/test folder
public class TestService {
JsonUtil jsonUtil;
String jsonString;
#Before
public void setData() {
jsonString = "{\"id\":\"one\"}";
jsonUtil = new JsonUtil(new ObjectMapper());
}
#Test
public void testGetStringAsJson() {
JsonNode node = jsonUtil.getStringAsJson(jsonString);
Assert.assertEquals("one", node.get("id").textValue());
}
}
Below is my 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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xyz</groupId>
<artifactId>xyz</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>xyz</name>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.4.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<!-- dependency versions -->
<com.google.guava.guava.version>22.0</com.google.guava.guava.version>
<io.springfox.springfox-swagger2>2.7.0</io.springfox.springfox-swagger2>
<io.springfox.springfox-swagger-ui>2.7.0</io.springfox.springfox-swagger-ui>
</properties>
<dependencies>
<!-- For default Spring Boot utilities -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<!-- For testing possibility -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<!-- For all mvc and web functions -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-hateoas</artifactId>
</dependency>
<!-- Spring security related dependencies
<dependency>
<groupId>org.springframework.security.oauth</groupId>
<artifactId>spring-security-oauth2</artifactId>
</dependency>-->
<!-- Default persistence functions -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-java8</artifactId>
<version>5.0.5.Final</version>
</dependency>
<!-- In-Memory DB -->
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
</dependency>
<!-- Java Utilities from google -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${com.google.guava.guava.version}</version>
</dependency>
<!-- Include swagger for API description -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${io.springfox.springfox-swagger2}</version>
</dependency>
<!-- Include swagger for API description UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${io.springfox.springfox-swagger-ui}</version>
</dependency>
<!-- Common libraries -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-lang/commons-lang -->
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.6</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
Maven output
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building xyz 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) # xyz ---
[INFO] Deleting C:\Users\rk\Documents\WS\xyz\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # xyz ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # xyz ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 17 source files to C:\Users\rk\Documents\WS\xyz\target\classes
[WARNING] /C:/Users/rk/Documents/WS/xyz/src/main/java/com/weather/xyzTestApplication.java: C:\Users\rk\Documents\WS\xyz\src\main\java\com\weather\xyzTestApplication.java uses or overrides a deprecated API.
[WARNING] /C:/Users/rk/Documents/WS/xyz/src/main/java/com/weather/xyzTestApplication.java: Recompile with -Xlint:deprecation for details.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # xyz ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # xyz ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to C:\Users\rk\Documents\WS\xyz\target\test-classes
[WARNING] /C:/Users/rk/Documents/WS/xyz/src/test/java/com/weather/controller/TestxyzController.java: C:\Users\rk\Documents\WS\xyz\src\test\java\com\weather\controller\TestxyzController.java uses unchecked or unsafe operations.
[WARNING] /C:/Users/rk/Documents/WS/xyz/src/test/java/com/weather/controller/TestxyzController.java: Recompile with -Xlint:unchecked for details.
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) # xyz ---
[INFO]
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) # xyz ---
[INFO] Building jar: C:\Users\rk\Documents\WS\xyz\target\xyz-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- spring-boot-maven-plugin:1.5.4.RELEASE:repackage (default) # xyz ---
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) # xyz ---
[INFO] Installing C:\Users\rk\Documents\WS\xyz\target\xyz-0.0.1-SNAPSHOT.jar to C:\Users\rk\.m2\repository\com\weather\xyz\0.0.1-SNAPSHOT\xyz-0.0.1-SNAPSHOT.jar
[INFO] Installing C:\Users\rk\Documents\WS\xyz\pom.xml to C:\Users\rk\.m2\repository\com\weather\xyz\0.0.1-SNAPSHOT\xyz-0.0.1-SNAPSHOT.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 16.643 s
[INFO] Finished at: 2018-09-24T22:44:24+05:30
[INFO] Final Memory: 34M/248M
[INFO] ------------------------------------------------------------------------
Check pom.xml go to 'Effective POM' view.
Check the value for tag under . It seems like it is not pointing to the proper location. You may override the property in pom.xml if it is pointing to a different location.
How would you have created the pom through spring initializer or manually? Most likely build path issue causing plugin not to execute. Can you check which version is being used once run through eclipse later verify through mvn dependency: tree just to know the same version is also available from cmd.
I'm currently receiving this log when running 'mvn test'
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Envirosite-Regression 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # Envirosite-Regression ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\christian.nuval\Envirosite-Regression\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # Envirosite-Regression ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # Envirosite-Regression ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # Envirosite-Regression ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # Envirosite-Regression ---
[INFO] Surefire report directory: C:\Users\christian.nuval\Envirosite-Regression\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running com.EnvirositeRegression.bdd.IssueTest
Configuring TestNG with: org.apache.maven.surefire.testng.conf.TestNG652Configurator#7a46a697
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.385 sec
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.374 s
[INFO] Finished at: 2016-07-21T16:32:18+08:00
[INFO] Final Memory: 12M/225M
[INFO] ------------------------------------------------------------------------
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.EnvirositeRegression.bdd</groupId>
<artifactId>Envirosite-Regression</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Envirosite-Regression</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-java</artifactId>
<version>1.1.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-junit</artifactId>
<version>1.1.8</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-core</artifactId>
<version>1.2.4</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openqa.selenium.core</groupId>
<artifactId>selenium-core</artifactId>
<version>1.0-20080914.225453</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.0</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.9.10</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.4</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.14</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>cucumber-tests</id>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<configuration>
<includes>
<include>**/*Test.java</include>
</includes>
</configuration>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
My IssueTest.java looks like this :
package com.EnvirositeRegression.bdd;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
import org.junit.runner.RunWith;
#RunWith(Cucumber.class)
#CucumberOptions(
format = { "pretty", "html:target/cucumber" },
glue = "com.EnvirositeRegression.bdd",
features = "SiteSearchTool.feature"
)
public class IssueTest {
}
I don't know why the IssueTest.Java is not properly read even though I added it as an inclusion in my build configuration of maven-surefire-plugin.
Please advise.
Your logs are showing SUCCESS with no executed tests because there are no tests to run i.e. no tests are written in your IssueTest. Try an example test-case, then run mvn test.
public class IssueTest {
#Test
public void exampleReturnsTrue()
{
assertTrue("This will succeed.", true);
}
}
A side-note:
If your tests are located where there supposed to be (./src/tests/java/); I suppose your pom.xml could do without the <configuration> [...] </configuration> clause, so:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
</plugin>
You have 2 configuration tags one after another - try to remove one of them and see. Also, it's a good idea in cases like that to debug maven execution with -X flag.