Test case failure in sonar - java

I am trying to get sonar report for one of my project.
I have run mvn clean install
Running blah.blah.BlahTest1
Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.016 sec
Running blah.blah.BlahTest2
Tests run: 3, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.078 sec
When I run mvn sonar:sonar I get the bellow error.
[INFO] ------------------------------------------------------------------------
[INFO] Building Component name
[INFO] task-segment: [org.apache.maven.plugins:maven-surefire-plugin:2.4.3:test]
[INFO] ------------------------------------------------------------------------
[INFO] [surefire:test {execution: default-cli}]
[INFO] Surefire report directory: D:\CodeBase\Project\module\target\surefire-reports
java.lang.NoClassDefFoundError: null
Caused by: java.lang.ClassNotFoundException: null
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: null. Program will exit.
Exception in thread "main"
[ERROR] There are test failures.
I am not sure where to start looking to. I tried searching in google couldn't find anything similar to my issue.
Please help me in understanding which can be a possible cause to look for.
Thanks.
Adding pom file : Removed few details to shorten the file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<!--============================================================= -->
<!--The Basics -->
<!--============================================================= -->
<groupId>###</groupId>
<artifactId>###</artifactId>
<packaging>pom</packaging>
<version>###</version>
<url>###</url>
<!--============================================================= -->
<!--Project Information -->
<!--============================================================= -->
<!--============================================================= -->
<!--Properties -->
<!--============================================================= -->
<properties>
<!--general properties -->
<svn-base-url>###</svn-base-url>
<!--versions of 3rd party libraries -->
<!--plug in versions -->
<version.jacoco.plugin>0.7.4.201502262128</version.jacoco.plugin>
</properties>
<scm>
</scm>
<!--============================================================= -->
<!--Modules -->
<!--============================================================= -->
<modules>
</modules>
<!--============================================================= -->
<!--Distribution Management -->
<!--============================================================= -->
<distributionManagement>
</distributionManagement>
<!--============================================================= -->
<!--Plugin Repository -->
<!--============================================================= -->
<pluginRepositories>
</pluginRepositories>
<!--============================================================= -->
<!--Dependency Management -->
<!--============================================================= -->
<dependencyManagement>
<!--3rd part libraries -->
</dependencyManagement>
<!--============================================================= -->
<!--Dependencies -->
<!--============================================================= -->
<dependencies>
</dependencies>
<!--============================================================= -->
<!--Build Information -->
<!--============================================================= -->
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>**/*</exclude>
</excludes>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-clean-plugin</artifactId>
<version>${version.clean.plugin}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>${version.compiler.plugin}</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<fork>true</fork>
<meminitial>128m</meminitial>
<maxmem>512m</maxmem>
<compilerArgument>-Xlint:-serial -Xmaxwarns 9999 -Xmaxerrs 9999</compilerArgument>
</configuration>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>${version.jacoco.plugin}</version>
<configuration>
<append>true</append>
<destFile>target/coverage-reports/jacoco-unit.exec</destFile>
<dataFile>target/coverage-reports/jacoco-unit.exec</dataFile>
<includes>
<include>path</include>
</includes>
</configuration>
<executions>
<execution>
<id>prepare-agent</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
<execution>
<id>report</id>
<phase>prepare-package</phase>
<goals>
<goal>report</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>${version.surefire.plugin}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>${version.enforcer.plugin}</version>
<configuration>
<rules>
<requireJavaVersion>
<version>1.6</version>
</requireJavaVersion>
<requireMavenVersion>
<version>2.2.0</version>
</requireMavenVersion>
</rules>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>${version.versions.plugin}</version>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>${version.assembly.plugin}</version>
<configuration>
<descriptors>
<!-- descriptors -->
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>${version.release.plugin}</version>
<configuration>
<goals>deploy</goals>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>${version.resources.plugin}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>${version.install.plugin}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-site-plugin</artifactId>
<version>${version.site.plugin}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jxr-plugin</artifactId>
<version>${version.jxr.plugin}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>${version.cobertura.plugin}</version>
<configuration>
<formats>
<format>xml</format>
</formats>
<instrumentation>
<!--Include and exclude -->
</instrumentation>
<maxmem>512M</maxmem>
</configuration>
<executions>
<execution>
<id>clean</id>
<phase>pre-site</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
<execution>
<id>instrument</id>
<phase>package</phase>
<goals>
<goal>cobertura</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${version.pmd.plugin}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${version.findbugs.plugin}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${version.checkstyle.plugin}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>dashboard-maven-plugin</artifactId>
<version>${version.dashboard.plugin}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${version.buildhelper.plugin}</version>
</plugin>
<plugin>
<groupId>org.jvnet.jaxb2.maven2</groupId>
<artifactId>maven-jaxb2-plugin</artifactId>
<version>${version.jaxb2.plugin}</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>taglist-maven-plugin</artifactId>
<version>${version.taglist.plugin}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-changelog-plugin</artifactId>
<version>${version.changelog.plugin}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-scm-plugin</artifactId>
<version>1.2</version>
<configuration>
<connectionType>developerConnection</connectionType>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>${version.jar.plugin}</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>${version.exec-maven.plugin}</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${version.antrun.plugin}</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>remove-project-artifact</id>
<phase>clean</phase>
<goals>
<goal>remove-project-artifact</goal>
</goals>
<configuration>
<removeAll>false</removeAll>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<!-- Need the argLine in the configuration here otherwise jacoco hook into surefire correctly for unit test coverage -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<forkMode>once</forkMode>
<argLine>${argLine} -XX:MaxPermSize=256M -Xmx892M -client</argLine>
</configuration>
</plugin>
</plugins>
</build>
</project>

I'm not a Maven expert, though but, I have implementation wherein, during the maven lifecycle, I execute some of the JUnits to find the Code Coverage and Sonar, of course. I'm attaching my pom. Maybe this helps.
<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>
<!-- Project Parent POM -->
<parent>
<groupId>XXX</groupId>
<artifactId>XXX</artifactId>
<version>2.0</version>
</parent>
<!-- Artifacts for the WAR -->
<groupId>XXX</groupId>
<artifactId>XXX</artifactId>
<packaging>war</packaging>
<version>0.1</version>
<name>XXX</name>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<version>0.5.3.201107060350</version>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<executions>
<execution>
...
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
<configuration>
<destFile>${sonar.jacoco.itReportPath}</destFile>
</configuration>
<executions>
<execution>
<id>pre-test</id>
<goals>
<goal>prepare-agent</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.17</version>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit47</artifactId>
<version>2.17</version>
</dependency>
</dependencies>
<configuration>
<argLine>
${argLine} -DAdditional Arguments
</argLine>
<includes>
<include>**/TestSuite.java</include>
</includes>
<skipTests>false</skipTests>
<forkCount>1</forkCount>
<reuseForks>true</reuseForks>
<executions>
<execution>
<id>test</id>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<!--Dependencies -->
</dependencies>
<!-- Properties of the dependencies defined above -->
<properties>
<!-- Versions -->
<!-- Sonar Properties -->
<sonar.java.coveragePlugin>jacoco</sonar.java.coveragePlugin>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<sonar.jacoco.itReportPath>${project.basedir}/target/jacoco-it.exec</sonar.jacoco.itReportPath>
<sonar.language>java</sonar.language>
</properties>

Related

How to deploy a multi module project to Artifactory

I want to deploy a "toolbox" to Artifactory with Maven. It's essentially a multi module project.
The goal is to deploy the toolbox, and pull it from another projects, either the separate tools or the whole toolbox. For example:
toolbox project name: `backend-tools`
tools: `mail`
and I want to pull it from another project like this:
<dependency>
<groupId>com.example</groupId>
<artifactId>backend-tools</artifactId>
<version>1.17</version>
</dependency>
Alternatively, I want, that you can pull the individual projects like this:
<dependency>
<groupId>com.example</groupId>
<artifactId>mail</artifactId>
<version>1.1</version>
</dependency>
When I pull the project the following error appears:
Could not find artifact com.example.itlab:backend-tools:pom:v0.0.1 in artifactory ({{{artifactory link}}})
my current setup:
pom.xml (mail)
<modelVersion>4.0.0</modelVersion>
<packaging>jar</packaging>
<parent>
<groupId>com.example</groupId>
<artifactId>backend-tools</artifactId>
<version>1.2</version>
</parent>
<groupId>com.example</groupId>
<artifactId>mail</artifactId>
<version>1.1</version>
<dependencies>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/resources</directory>
<excludes>
<exclude>log4j2.xml</exclude>
<exclude>*.yml</exclude>
<exclude>*.mailprops.json</exclude>
<exclude>*_instance.properties</exclude>
</excludes>
</resource>
</resources>
<finalName>${project.artifactId}-${project.version}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<artifactSet>
<excludes>
<exclude>com.example.mail.Main</exclude>
</excludes>
</artifactSet>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
pom.xml (backend-tools)
<modelVersion>4.0.0</modelVersion>
<modules>
<module>mail</module>
</modules>
<organization>
<name><!-- ORGANISATION NAME --></name>
<url><!-- ORGANISATION URL --></url>
</organization>
<developers>
<developer>
<name><!-- DEV NAME--></name>
<roles>
<role>Developer</role>
</roles>
<email><!-- DEV EMAIL --></email>
</developer>
</developers>
<groupId>com.example.itlab</groupId>
<artifactId>backend-tools</artifactId>
<version>1.2</version>
<name>backend-tools</name>
<description>All Tools for the Backend</description>
<packaging>pom</packaging>
<properties>
<mail.version>1.4.7</mail.version>
</properties>
<distributionManagement>
<repository>
<id>release</id>
<name>Artifactory-Primary-snapshots</name>
<url><!-- <ARTIFACTORY LINK> --></url>
</repository>
<snapshotRepository>
<id>snapshot</id>
<uniqueVersion>true</uniqueVersion>
<url><!-- <ARTIFACTORY LINK> --></url>
</snapshotRepository>
</distributionManagement>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>${mail.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.4.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>17</source>
<target>17</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.1.2</version>
<configuration>
<outputDirectory>../target</outputDirectory>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.4.1</version>
<configuration>
<doclint>-html,-syntax,-accessibility,-missing</doclint>
<failOnError>false</failOnError>
<quiet>true</quiet>
<reportOutputDirectory>${project.build.directory}</reportOutputDirectory>
</configuration>
<executions>
<execution>
<phase>generate-resources</phase>
<id>attach-javadocs</id>
<goals>
<goal>javadoc</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>

Fatal error compiling: invalid flag: --release packaging RedFX-Quantum/Strange

attempting to build [RedFX-Quantum/Strange][1]. When running mvn package, I get "Fatal error compiling: invalid flag: --release". the pom.xml file is below:
<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>
<groupId>org.redfx</groupId>
<artifactId>strange</artifactId>
<packaging>jar</packaging>
<version>0.1.3</version>
<name>Strange</name>
<description>Strange Quantum Simulator</description>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<javadoc.plugin.version>3.2.0</javadoc.plugin.version>
<gpg.plugin.version>1.6</gpg.plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.5.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.5.2</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.5.2</version>
</dependency>
<!--
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-native</artifactId>
<version>1.0.0-beta7</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-nop</artifactId>
<version>1.7.26</version>
</dependency>
-->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.7.0</version>
<configuration>
<release>10</release>
</configuration>
<dependencies>
<dependency>
<groupId>org.ow2.asm</groupId>
<artifactId>asm</artifactId>
<version>6.1.1</version> <!-- Use newer version of ASM -->
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>org.redfx.strange.demo.Demo</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.2</version>
<executions>
<execution>
<goals>
<goal>test-jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<trimStackTrace>false</trimStackTrace>
</configuration>
</plugin>
<!--
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
-->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-no-snapshots</id>
<phase>install</phase>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireReleaseDeps>
<message>Snapshot dependencies are not allowed for release project version!</message>
<onlyWhenRelease>true</onlyWhenRelease>
</requireReleaseDeps>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>2.0.0</version>
<configuration>
<organizationName>Johan Vos</organizationName>
<inceptionYear>2020</inceptionYear>
<licenseName>bsd_3</licenseName>
<addJavaLicenseAfterPackage>false</addJavaLicenseAfterPackage>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</snapshotRepository>
<repository>
<id>ossrh</id>
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<profiles>
<profile>
<id>release</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>2.2.1</version>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${javadoc.plugin.version}</version>
<configuration>
<detectJavaApiLink>false</detectJavaApiLink>
<source>8</source>
</configuration>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<configuration>
<skip>false</skip>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>${gpg.plugin.version}</version>
<executions>
<execution>
<id>sign-artifacts</id>
<phase>verify</phase>
<goals>
<goal>sign</goal>
</goals>
<configuration>
<!-- This is necessary for gpg to not try to use the pinentry programs -->
<!-- Only required for GPG >= 2.2 -->
<!--
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
-->
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<scm>
<connection>scm:git:git://github.com/redfx-quantum/strange.git</connection>
<developerConnection>scm:git:git#github.com:redfx-quantum/strange.git</developerConnection>
<url>https://github.com/redfx-quantum/strange</url>
<tag>HEAD</tag>
</scm>
</project>
running mvn package -e didn't give any noticeably different output and mvn package -X didn't give me anything I could understand. How would I go about fixing it? Looking in the pom.xml file, the only release related thing I could see was the <release>10<\release> but idk what to change that to if that is the problem. I'm assuming I have to change things in the file to fit what versions of java and maven I have but I'm pretty new to the both of them and don't really know what I'm looking for.
[1]https://github.com/redfx-quantum/strange

Building two ears from two wars in one webapp

as always, excuse me if I make a silly query or one that is easily resolved. In a project I'm working on I was asked to find out if it's possible to build two wars from one webapp. This I could solve in the following way:
WebProject
<artifactId>FacturaElectronica</artifactId>
<packaging>war</packaging>
<name>factElectronica - web</name>
<description>This is the web POM file</description>
<groupId>factElectronica-web</groupId>
<version>1.0-SNAPSHOT</version>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>default-install</id>
<phase>never</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.2</version>
<executions>
<execution>
<id>default-war</id>
<phase>none</phase>
<configuration>
<finalName>unwanted</finalName>
<classifier>unwanted</classifier>
</configuration>
</execution>
<execution>
<id>facturaelectronicafija</id>
<phase>install</phase>
<goals>
<goal>war</goal>
</goals>
<configuration>
<classifier>facturaelectronicafija</classifier>
<webResources>
<resource>
<filtering>true</filtering>
<directory>src/main/webapp</directory>
<includes>
<include>**</include>
</includes>
</resource>
<resource>
<directory>src/main/webapp</directory>
</resource>
</webResources>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifestEntries>
<Dependencies>org.apache.santuario.xmlsec,org.apache.commons.codec,javax.ws.rs.api</Dependencies>
</manifestEntries>
</archive>
</configuration>
</execution>
<execution>
<id>facturaelectronicamovil</id>
<phase>install</phase>
<goals>
<goal>war</goal>
</goals>
<configuration>
<classifier>facturaelectronicamovil</classifier>
<webResources>
<resource>
<filtering>true</filtering>
<directory>src/main/webapp</directory>
<includes>
<include>**</include>
</includes>
</resource>
<resource>
<directory>src/main/webappFant</directory>
</resource>
</webResources>
<failOnMissingWebXml>false</failOnMissingWebXml>
<archive>
<manifestEntries>
<Dependencies>org.apache.santuario.xmlsec,org.apache.commons.codec,javax.ws.rs.api</Dependencies>
</manifestEntries>
</archive>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>src/main/java/resources</directory>
</resource>
</resources>
</build>
Each of these war has the same classes but differs in the xhtml files. One points to mobile phone components and the other points to landline phone components.
After doing this, I realized that it was necessary to build an ear for each one of them, each one with its root context and perform the deploy in wildfly. But I can't find the way to do it. On the one hand I don't know how to point to the wars that are built in the execution in the webapp, and on the other hand I don't know if the way is only with one ear for both or it is necessary to build two. I would be very grateful if someone could give me a hand with this. Thank you very much!
Update
Taking the example I found in this link: Maven ear plugin multiple artifacts content
I made the following changes:
WebProject
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<id>package-facturaelectronicafija</id>
<phase>package</phase>
<configuration>
<classifier>facturaelectronicafija</classifier>
<webappDirectory>${project.build.directory}/${project.build.finalName}-facturaelectronicafija</webappDirectory>
<webResources>
<resource>
<directory>src/main/webapp</directory>
</resource>
</webResources>
</configuration>
<goals>
<goal>war</goal>
</goals>
</execution>
<execution>
<id>package-facturaelectronicamovil</id>
<phase>package</phase>
<configuration>
<classifier>facturaelectronicamovil</classifier>
<webappDirectory>${project.build.directory}/${project.build.finalName}-facturaelectronicamovil</webappDirectory>
<webResources>
<resource>
<directory>src/main/webappFant</directory>
</resource>
</webResources>
</configuration>
<goals>
<goal>war</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<finalName>FacturaElectronica</finalName>
</build>
</project>
EarProject
<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>
<groupId>factElectronicaWeb-ear</groupId>
<artifactId>factElectronicaWeb-ear</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<version>1.0-SNAPSHOT</version>
<type>war</type>
</dependency>
<dependency>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>facturaelectronicafija</classifier>
<scope>provided</scope>
<type>war</type>
</dependency>
<dependency>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<classifier>facturaelectronicamovil</classifier>
<version>1.0-SNAPSHOT</version>
<scope>provided</scope>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<!-- <groupId>org.apache.maven.plugins</groupId> -->
<artifactId>maven-ear-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>package-facturaelectronicafija</id>
<phase>package</phase>
<configuration>
<workDirectory>target/facturaelectronicafija</workDirectory>
<classifier>facturaelectronicafija</classifier>
<version>8</version>
<modules>
<webModule>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<classifier>facturaelectronicafija</classifier>
<contextRoot>/FacturaElectronica</contextRoot>
<bundleFileName>/FacturaElectronica.war</bundleFileName>
</webModule>
</modules>
</configuration>
<goals>
<goal>ear</goal>
</goals>
</execution>
<execution>
<id>package-facturaelectronicamovil</id>
<phase>package</phase>
<configuration>
<workDirectory>target/facturaelectronicamovil</workDirectory>
<classifier>facturaelectronicamovil</classifier>
<version>8</version>
<modules>
<webModule>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<classifier>facturaelectronicamovil</classifier>
<contextRoot>/FacturaElectronica</contextRoot>
<bundleFileName>/FacturaElectronica.war</bundleFileName>
</webModule>
</modules>
</configuration>
<goals>
<goal>ear</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<finalName>FacturaElectronica</finalName>
</build>
</project>
Now the executions are done and maven creates three ears, the first one, which is called "FacturaElectronica" I created it to test that it actually works. The problem is that the three ears have exactly the same content as "FacturaElectronica". I think it is because maven does not find the dependence towards "facturaelectronicafija" and "facturaelectronicafija". Maybe because when I create these WARs in executions I can't add a version to them. Somebody could clarify me this please? Thank you very much!
I would create a multi-module project where each WAR and each EAR are separate modules.
The classes would be a JAR module that is used in the two WAR modules
I had to make some corrections, but I managed to leave it working as expected.
WebProject
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<pluginManagement>
<plugins>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>default-install</id>
<phase>never</phase>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<executions>
<execution>
<id>default-war</id>
<phase>none</phase>
<configuration>
<finalName>unwanted</finalName>
<classifier>unwanted</classifier>
</configuration>
</execution>
<execution>
<id>package-facturaelectronicafija</id>
<phase>package</phase>
<configuration>
<classifier>facturaelectronicafija</classifier>
<webappDirectory>${project.build.directory}/${project.build.finalName}-facturaelectronicafija</webappDirectory>
<webResources>
<resource>
<directory>src/main/webapp</directory>
</resource>
</webResources>
</configuration>
<goals>
<goal>war</goal>
</goals>
</execution>
<execution>
<id>package-facturaelectronicamovil</id>
<phase>package</phase>
<configuration>
<classifier>facturaelectronicamovil</classifier>
<webappDirectory>${project.build.directory}/${project.build.finalName}-facturaelectronicamovil</webappDirectory>
<webResources>
<resource>
<directory>src/main/webappFant</directory>
</resource>
</webResources>
</configuration>
<goals>
<goal>war</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
<finalName>FacturaElectronica</finalName>
</build>
The default install run is there so that the default war base is not created.
EarProject
<modelVersion>4.0.0</modelVersion>
<groupId>factElectronicaWeb-ear</groupId>
<artifactId>factElectronicaWeb-ear</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>ear</packaging>
<dependencies>
<dependency>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<version>1.0-SNAPSHOT</version>
<classifier>facturaelectronicafija</classifier>
<scope>compile</scope>
<type>war</type>
</dependency>
<dependency>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<classifier>facturaelectronicamovil</classifier>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
<type>war</type>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<executions>
<execution>
<id>default-install</id>
<phase>never</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ear-plugin</artifactId>
<version>3.0.2</version>
<executions>
<execution>
<id>default-ear</id>
<phase>none</phase>
<configuration>
<finalName>unwanted</finalName>
<classifier>unwanted</classifier>
</configuration>
</execution>
<execution>
<id>package-facturaelectronicafija</id>
<phase>package</phase>
<configuration>
<workDirectory>target/facturaelectronicafija</workDirectory>
<classifier>facturaelectronicafija</classifier>
<version>8</version>
<modules>
<webModule>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<classifier>facturaelectronicafija</classifier>
<contextRoot>/FacturaElectronica</contextRoot>
<bundleFileName>/FacturaElectronica-facturaelectronicafija.war</bundleFileName>
</webModule>
<webModule>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<classifier>facturaelectronicamovil</classifier>
<excluded>true</excluded>
</webModule>
</modules>
</configuration>
<goals>
<goal>ear</goal>
</goals>
</execution>
<execution>
<id>package-facturaelectronicamovil</id>
<phase>package</phase>
<configuration>
<workDirectory>target/facturaelectronicamovil</workDirectory>
<classifier>facturaelectronicamovil</classifier>
<version>8</version>
<modules>
<webModule>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<classifier>facturaelectronicamovil</classifier>
<contextRoot>/DetalleFactura</contextRoot>
<bundleFileName>/FacturaElectronica-facturaelectronicamovil.war</bundleFileName>
</webModule>
<webModule>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<classifier>facturaelectronicafija</classifier>
<excluded>true</excluded>
</webModule>
</modules>
</configuration>
<goals>
<goal>ear</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
<finalName>FacturaElectronica</finalName>
</build>
Previously the dependencies generated only a meta inf file, this was because they were with a scope provided, when you switch to compile it works correctly.
<dependency>
<groupId>factElectronica-web</groupId>
<artifactId>FacturaElectronica</artifactId>
<classifier>facturaelectronicamovil</classifier>
<version>1.0-SNAPSHOT</version>
<scope>compile</scope>
<type>war</type>
</dependency>

Why does maven not run Junit tests after 'clean'

I am building a Java RESTful web service using dropwizard. The tests do not run consistently though. If I run the test manually, then mvn test the test will run.
If I run mvn clean test I get
No tests to run.
Until I run the test manually again. My project structure is as follows:
This is my pom.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<prerequisites>
<maven>3.0.0</maven>
</prerequisites>
<groupId>com.workflowstreamer</groupId>
<artifactId>workflowstreamer</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>WorkflowStreamer</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<dropwizard.version>1.3.7</dropwizard.version>
<mainClass>com.workflowstreamer.WorkflowStreamerApplication</mainClass>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-bom</artifactId>
<version>1.3.7</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-core</artifactId>
</dependency>
<dependency>
<groupId>io.dropwizard</groupId>
<artifactId>dropwizard-testing</artifactId>
<version>1.3.7</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.1</version>
<configuration>
<createDependencyReducedPom>true</createDependencyReducedPom>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>${mainClass}</mainClass>
</transformer>
</transformers>
<!-- exclude signed Manifests -->
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>${mainClass}</mainClass>
</manifest>
</archive>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.6.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<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>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.0.0-M1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>2.8.1</version>
<configuration>
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
<dependencyDetailsEnabled>false</dependencyDetailsEnabled>
</configuration>
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.10.3</version>
</plugin>
</plugins>
</reporting>
</project>
I found the problem. It problem was with my test folder structure.
[] src
[] main
[] ...
[] test
[] java
[] ...
java was not set as the "Test Sources Root". So the test-classes were not generated.
I was able to find a solution after #chrylis pointed me in the right direction in his comment.

TestNG tests don't run in Maven Project alongside JUnit4 projects

This is a project that uses both TestNG and JUnit4. I am not able to run the TestNG test suite for any reason. The error stack trace is given below.
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running TestSuite
Exception in thread "ThreadedStreamConsumer" java.lang.NoSuchMethodError: org.ap
ache.maven.surefire.report.StackTraceWriter.getThrowable()Ljava/lang/Throwable;
at org.apache.maven.surefire.report.XMLReporter.writeTestProblems(XMLRep
orter.java:272)
at org.apache.maven.surefire.report.XMLReporter.testFailed(XMLReporter.j
ava:249)
at org.apache.maven.surefire.report.MulticastingReporter.testFailed(Mult
icastingReporter.java:80)
at org.apache.maven.surefire.report.TestSetRunListener.testFailed(TestSe
tRunListener.java:157)
at org.apache.maven.plugin.surefire.booterclient.output.ForkClient.consu
meLine(ForkClient.java:106)
at org.apache.maven.plugin.surefire.booterclient.output.ThreadedStreamCo
nsumer$Pumper.run(ThreadedStreamConsumer.java:67)
at java.lang.Thread.run(Thread.java:722)
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
My pom set up is given below
<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>
<prerequisites>
<maven>3.0.4</maven>
</prerequisites>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<surefire.version>2.13</surefire.version>
</properties>
<parent>
<groupId>com.google</groupId>
<artifactId>google</artifactId>
<version>1</version>
</parent>
<groupId>com.google.testing</groupId>
<artifactId>test-libraries-for-java</artifactId>
<version>1.2</version>
<profiles>
<profile>
<id>junit4-only</id>
<build>
<finalName>tl4j</finalName>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>junit4-only-${project.version}</classifier>
<includes>
<include>**/junit4/*</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>agnostic</id>
<build>
<finalName>tl4j</finalName>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>agnostic-${project.version}</classifier>
<includes>
<include>**/common/testing/*.class</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>junit4</id>
<build>
<finalName>tl4j</finalName>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>junit4-${project.version}</classifier>
<includes>
<include>**/common/testing/*.class</include>
<include>**/junit4/*</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>testng</id>
<build>
<finalName>tl4j</finalName>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>testng-${project.version}</classifier>
<includes>
<include>**/common/testing/*.class</include>
<include>**/testng/*</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>testng-only</id>
<build>
<finalName>tl4j</finalName>
<plugins>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>jar</goal>
</goals>
<configuration>
<classifier>testng-${project.version}</classifier>
<includes>
<include>**/testng/*</include>
</includes>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.3.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.15</version>
<type>maven-plugin</type>
</dependency>
</dependencies>
<build>
<!-- <finalName>tl4j</finalName> -->
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<outputDirectory>${basedir}/target-eclipse/classes</outputDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<id>deploy</id>
<phase>deploy</phase>
<configuration>
<tasks>
<echo
message="Please follow directions at doc/HOW_TO_RELEASE.txt to make the release" />
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-junit4</artifactId>
<version>${surefire.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
<artifactId>surefire-testng</artifactId>
<version>${surefire.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>2.7</version>
<configuration>
<show>private</show>
<nohelp>true</nohelp>
</configuration>
</plugin>
</plugins>
</reporting>
My unit test
import org.testng.Assert;
import org.testng.annotations.Test;
public class TearDownTestCaseTest {
#Test
public void assertTrue() {
Assert.assertTrue(true);
}
}
Funny thing is that if I configure this test to run as JUnit 3 test case, it works, but not JUnit 4.x or Testng.

Categories

Resources