Maven failing to run Junit Tests on mvn -test - java

I have some Selenium Webdriver tests that I'd like to run from command line using mvn -test. Problem is that I can clean, build and compile with no issues but no tests run. I get no message relating to test such as "There are no tests to run."
My junit tests are following the *test class naming convention.
I have compared my POM with another project that runs tests no problem and it is identical, bar the project name and location. The project which works is under my User directory but the one that doesn't is directly underneath c:\
I'm not proficient enough to be able to debug this with mn -x yet so any help much appreciated. Here is my POM:
<?xml version="1.0" encoding="UTF-8"?>
http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
<groupId>websiteRegression</groupId>
<artifactId>websiteRegression</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>websiteRegression</name>
<url></url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<!-- Full access to hamcrest matchers
see https://github.com/hamcrest/JavaHamcrest
you can add hamcrest-core for the foundation matchers
and you can add hamcrest-library for more extensive libraries
or you can add hamcrest-all for everything if you don't want to think about it
-->
<!-- Junit 4.11 needs hamcrest 1.3 -->
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
</dependency>
<!-- if we use junit-dep then we can bring in the full hamcrest -->
<!-- JUnit 4.10 depends on hamcrest 1.1 -->
<!--
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
<version>4.10</version>
</dependency>
-->
<!-- Use JUnit as our test framework -->
<!-- this gives us basic hamcrest -->
<!-- <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.10</version>
<scope>test</scope>
</dependency> -->
<!-- if I want to use a version of hamcrest above 1.1 with 4.10 then I need an exclusion -->
<!--
<dependency>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-all</artifactId>
<version>1.3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit-dep</artifactId>
<version>4.10</version>
<exclusions>
<exclusion>
<groupId>org.hamcrest</groupId>
<artifactId>hamcrest-core</artifactId>
</exclusion>
</exclusions>
</dependency>
-->
<dependency>
<!-- bring in the full selenium deploy
we could be more selective and bring
only what we need -->
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.39.0</version>
</dependency>
<dependency>
<groupId>com.opera</groupId>
<artifactId>operadriver</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
<!-- I have added the build section to support importing into
IntelliJ automatically without throwing errors about wrong Java
Version. This basically says the source requires at least Java 1.7
and use a compiler that outputs Java 1.7 -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<profiles>
<profile>
<id>anyBrowserTests</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.14.1</version>
<configuration>
<includes>
<include>**/AllBrowserSuiteTest.class</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>firefoxTests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/AllBrowserSuiteTest.class</include>
<include>**/FailOnChromeAndOperaAndIESuiteTest.class</include>
<include>**/FailOnChromeAndOperaSuiteTest.class</include>
<include>**/FailOnOperaSuiteTest.class</include>
<include>**/FireFoxOnlySuiteTest.class</include>
<include>**/FailOnIEOnlySuiteTest.class</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>ieTests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/AllBrowserSuiteTest.class</include>
<include>**/FailOnChromeAndOperaSuiteTest.class</include>
<include>**/FailOnOperaSuiteTest.class</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>chromeTests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/AllBrowserSuiteTest.class</include>
<include>**/FailOnOperaSuiteTest.class</include>
<include>**/FailOnIEOnlySuiteTest.class</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>operaTests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/AllBrowserSuiteTest.class</include>
<include>**/FailOnIEOnlySuiteTest.class</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>failingOperaTests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/FailOnChromeAndOperaAndIESuiteTest.class</include>
<include>**/FailOnChromeAndOperaSuiteTest.class</include>
<include>**/FailOnOperaSuiteTest.class</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>failingIETests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<includes>
<include>**/FailOnChromeAndOperaAndIESuiteTest.class</include>
<include>**/FailOnIEOnlySuiteTest.class</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>failingChromeTests</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.16</version>
<configuration>
<includes>
<include>**/FailOnChromeAndOperaAndIESuiteTest.class</include>
<include>**/FailOnChromeAndOperaSuiteTest.class</include>
</includes>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-report-plugin</artifactId>
<version>2.16</version>
</plugin>
</plugins>
</reporting>
EDIT: Ok, I found it was a problem with Profiles - fixed!

EDIT: Ok, I found it was a problem with Profiles - fixed!

Related

Create SOAP web server with Java and Maven

I would like to create simple Java SOAP web service that should run on Tomcat 10. I'm using Eclipse and Maven for this purpose. I'm creating new Maven project and was stuck with Archetype selection. Which Archetype I should use?
Can I create project without selecting archetype? What basic section should exist in my pom.xml?
I would use maven-archetype-webapp.
Your pom will need some/all of the following to build a SOAP WS as a warfile to run in Tomcat.
<?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>foo.bar</groupId>
<artifactId>MyServiceWS</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>war</packaging>
<name>MyServiceWS</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<encoding>UTF-8</encoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/jakarta.jws/jakarta.jws-api -->
<dependency>
<groupId>jakarta.jws</groupId>
<artifactId>jakarta.jws-api</artifactId>
<version>2.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/jakarta.xml.bind/jakarta.xml.bind-api -->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>2.3.3</version>
</dependency>
<!-- https://mvnrepository.com/artifact/jakarta.xml.soap/jakarta.xml.soap-api -->
<dependency>
<groupId>jakarta.xml.soap</groupId>
<artifactId>jakarta.xml.soap-api</artifactId>
<version>1.4.2</version>
</dependency>
</dependencies>
<build>
<finalName>MyServiceWS</finalName>
<directory>${basedir}/target</directory>
<!-- main -->
<sourceDirectory>${basedir}/src/main/java</sourceDirectory>
<outputDirectory>${basedir}/target/classes</outputDirectory>
<!-- test -->
<testSourceDirectory>${basedir}/src/test/java</testSourceDirectory>
<testOutputDirectory>${basedir}/target/test-classes</testOutputDirectory>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>true</filtering>
<includes>
<include>*.properties</include>
<include>*.xml</include>
</includes>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<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-war-plugin</artifactId>
<version>3.2.3</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
<warSourceDirectory>${basedir}/src/main/webapp/WebContent</warSourceDirectory>
<warSourceExcludes>${basedir}/src/main/webapp/WEB-INF/web.xml</warSourceExcludes>
</configuration>
</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>
</build>
</project>

groovy-all is not Included When Installing with Maven

I am trying to create a simple project where I use maven to manage dependencies and using groovy as the main script.
I've included all the necessary libraries to run the groovy script
here is my 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.randomperson.hello</groupId>
<artifactId>TryMaven</artifactId>
<version>1.0-SNAPSHOT</version>
<name>TryMaven</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</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>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>2.5.7</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</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-surefire-plugin</artifactId>
<version>2.22.1</version>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<version>3.0.2</version>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<mainClass>com.randomperson.hello.App</mainClass>
</manifest>
</archive>
</configuration>
</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>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<compilerId>groovy-eclipse-compiler</compilerId>
<verbose>true</verbose>
<source>11</source>
<target>11</target>
</configuration>
<dependencies>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-compiler</artifactId>
<version>3.7.0</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-eclipse-batch</artifactId>
<version>3.0.8-01</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
when i install using mvn clean install the build is successful but when i tried to execute the .jar file using java -jar file.jar it gives this error
Error: Could not find or load main class com.randomperson.hello.App
Caused by: java.lang.NoClassDefFoundError: groovy/lang/GroovyObject
I am not quite sure how groovy work with maven but it seems that it does not include the groovy library specifically the groovy-all which is declared in dependencies.
I am using OpenJDK11 & Groovy 4.0.2
am I missing something?
Thank you in advance.

failsafe plugin does not pick the test classes even though I have the correct naming convention *IT.java

I have searched on the internet as well, but I could not find the exact problem that I am having.
TO explain what I am doing, I am writing selenium UI tests. I am trying to execute the test using the failsafe plugin. I am executing the maven command mvn clean verify but it does not execute any of my test classes.
However, my test classes are getting executed when I change my test class to *Test.java
I suspect that my project does not use failsafe instead uses surefire. I am posting my pom file, project structure and the build output.
POM File
<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>webproject</groupId>
<artifactId>webproject</artifactId>
<version>1.0-SNAPSHOT</version>
<name>webproject</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</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>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.13.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.14.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->
<plugins>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.0.0</version>
</plugin>
<!--see http://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.7.0</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.20.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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>2.20.0</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng/SampleSuiteIT.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
You have to move the maven-failsafe-plugin configuration out of <pluginManagement>..</pluginManagement>

Maven needs to run everytime after a file changes

My problem: I have to run maven clean site everytime a file is changed so that Eclipse runs the new version... Can someone help me? It's quite annoying to run clean site everytime.
This is (partially) my pom file:
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<slick2d.version>1.0.2</slick2d.version>
<junit.version>4.12</junit.version>
<json.plugin.version>1.1.1</json.plugin.version>
<mockito.version>1.9.5</mockito.version>
<findbugs.annotations.version>1.3.2</findbugs.annotations.version>
<javadoc.plugin.version>2.10.3</javadoc.plugin.version>
<checkstyle.plugin.version>2.17</checkstyle.plugin.version>
<pmd.plugin.version>3.6</pmd.plugin.version>
<findbugs.plugin.version>3.0.3</findbugs.plugin.version>
<cobertura.plugin.version>2.7</cobertura.plugin.version>
</properties>
<dependencies>
<dependency> <!-- slick2D dependency -->
<groupId>org.slick2d</groupId>
<artifactId>slick2d-core</artifactId>
<version>${slick2d.version}</version>
</dependency>
<dependency> <!-- junit dependency -->
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
</dependency>
<dependency> <!-- json dependency -->
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>${json.plugin.version}</version>
</dependency>
<dependency> <!-- mockito dependency -->
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>${mockito.version}</version>
</dependency>
<dependency>
<groupId>net.sourceforge.findbugs</groupId>
<artifactId>annotations</artifactId>
<version>${findbugs.annotations.version}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin> <!-- cobertura -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>${cobertura.plugin.version}</version>
<configuration>
<instrumentation>
<excludes>
<exclude>*/CoberturaIgnore.class</exclude>
<exclude>*/highscore/HighScore.class</exclude>
<exclude>*/pop/PopBehaviour.class</exclude>
<exclude>*/ui/*.class</exclude>
</excludes>
<ignoreMethodAnnotations>
<ignoreMethodAnnotation>spiceballs.CoberturaIgnore</ignoreMethodAnnotation>
</ignoreMethodAnnotations>
</instrumentation>
</configuration>
</plugin>
<plugin> <!-- checkstyle -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle.plugin.version}</version>
<configuration>
<configLocation>${basedir}/checkstyle.xml</configLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
</plugin>
<plugin> <!-- pmd -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${pmd.plugin.version}</version>
<configuration>
<skipEmptyReport>false</skipEmptyReport>
<includeTests>true</includeTests>
<rulesets>
<ruleset>pmd-rules.xml</ruleset>
</rulesets>
</configuration>
</plugin>
<plugin> <!-- findbugs -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugs.plugin.version}</version>
<configuration>
<xmlOutput>true</xmlOutput>
<includeTests>true</includeTests>
</configuration>
</plugin>
</plugins>
</build>
<reporting>
<plugins>
<plugin> <!-- javadoc report -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>${javadoc.plugin.version}</version>
<configuration>
<failOnError>false</failOnError>
</configuration>
<reportSets>
<reportSet>
<id>default</id>
<reports>
<report>javadoc</report>
</reports>
</reportSet>
</reportSets>
</plugin>
<plugin> <!-- cobertura report -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>${cobertura.plugin.version}</version>
</plugin>
<plugin> <!-- checkstyle report -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle.plugin.version}</version>
<configuration>
<configLocation>${basedir}/checkstyle.xml</configLocation>
<includeTestSourceDirectory>true</includeTestSourceDirectory>
</configuration>
</plugin>
<plugin> <!-- pmd report -->
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-pmd-plugin</artifactId>
<version>${pmd.plugin.version}</version>
<configuration>
<skipEmptyReport>false</skipEmptyReport>
<includeTests>true</includeTests>
<rulesets>
<ruleset>pmd-rules.xml</ruleset>
</rulesets>
</configuration>
</plugin>
<plugin> <!-- findbugs report -->
<groupId>org.codehaus.mojo</groupId>
<artifactId>findbugs-maven-plugin</artifactId>
<version>${findbugs.plugin.version}</version>
<configuration>
<xmlOutput>true</xmlOutput>
<includeTests>true</includeTests>
</configuration>
</plugin>
</plugins>
</reporting>
If you working within your workspace locally, you can just run -- clean compile --goals. When you are finally done and pushing to higher environments- DEV/TEST/pre-prod, then you would run all the recommended goals for your project.
Look into this link for more details on what each goal does-
https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html

Maven Deployment on Tomcat: only .java files in webapps

Using Maven and Tomcat 7.0.42
When my war files get deployed on my tomcat, I get a ClassNotFoundException. When looking into the folder on my tomcat, I only see a .java there but no .class file. Now just starting the server once again (as I did a lot recently) and it has the .class file. Didn't change anything! I just heard that we use the wtp plugin to deploy. Does this help?
What happened here?
<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>
<artifactId>SVIS3GWebDruck</artifactId>
<packaging>war</packaging>
<parent>
<groupId>de.svi.svis3g</groupId>
<artifactId>SVIS3G_Fragments</artifactId>
<version>3.6.0-SNAPSHOT</version>
</parent>
<profiles>
<profile>
<id>local_tomcat_admin_app_deploy</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0.1-sr-1</version>
<configuration>
<!-- Container configuration -->
<container>
<containerId>tomcat6x</containerId>
<type>remote</type>
</container>
<configuration>
<type>runtime</type>
<properties>
<cargo.remote.username>admin</cargo.remote.username>
<cargo.remote.password>pwd</cargo.remote.password>
<cargo.tomcat.manager.url>http://localhost:8080/manager</cargo.tomcat.manager.url>
</properties>
</configuration>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>local_tomcat_deploy</id>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<version>1.0.1-sr-1</version>
<configuration>
<!-- Container configuration -->
<container>
<containerId>tomcat6x</containerId>
</container>
<configuration>
<type>existing</type>
<home>B:\applicationserver\apache-tomcat-7.0.42</home>
</configuration>
<deployer>
<deployables>
<deployable>
<artifactId>SVIS3GWebDruck</artifactId>
<groupId>de.svi.svis3g</groupId>
<type>war</type>
</deployable>
</deployables>
</deployer>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>vt_tomcat_deploy</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.cargo</groupId>
<artifactId>cargo-maven2-plugin</artifactId>
<executions>
<execution>
<id>start-container</id>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>stop-container</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
<configuration>
<container>
<containerId>tomcat6x</containerId>
<type>remote</type>
</container>
<configuration>
<type>runtime</type>
<properties>
<cargo.remote.username>admin</cargo.remote.username>
<cargo.remote.password>pwd</cargo.remote.password>
<cargo.tomcat.manager.url>${ServerURL}/manager</cargo.tomcat.manager.url>
</properties>
</configuration>
<deployer>
<deployables>
<deployable>
<artifactId>SVIS3GWebDruck</artifactId>
<groupId>de.svi.svis3g</groupId>
<type>war</type>
</deployable>
</deployables>
</deployer>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib</artifactId>
</dependency>
<dependency>
<groupId>com.caucho.hessian</groupId>
<artifactId>hessian</artifactId>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-rt</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.svi.svis3g</groupId>
<artifactId>SVIS3GBirt</artifactId>
</dependency>
<dependency>
<groupId>de.svi.svis3g</groupId>
<artifactId>SVIS3GCommons</artifactId>
</dependency>
<dependency>
<groupId>de.svi.svis3g</groupId>
<artifactId>SVIS3GBusiness</artifactId>
</dependency>
<dependency>
<groupId>de.svi.svis3g</groupId>
<artifactId>SVIS3GBirtAPI</artifactId>
</dependency>
<dependency>
<groupId>de.svi.svis3g</groupId>
<artifactId>SVIS3GEISIntegrationAPI</artifactId>
</dependency>
<dependency>
<groupId>de.svi.svis3g</groupId>
<artifactId>SVIS3GEISIntegrationEVBDruck</artifactId>
</dependency>
<dependency>
<groupId>de.svi.svis3g</groupId>
<artifactId>SVIS3GEVBDruckWSGen</artifactId>
</dependency>
</dependencies>
<build>
<finalName>SVIS3GWebDruck</finalName>
<defaultGoal>install</defaultGoal>
<resources>
<resource>
<directory>src/main/resources/de/svi/svis3g/birt/resources</directory>
<targetPath>de/svi/svis3g/birt/resources</targetPath>
<filtering>false</filtering>
<includes>
<include>**/*.*</include>
</includes>
</resource>
</resources>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<webResources>
<resource>
<directory>target</directory>
<excludes>
<exclude>**/*</exclude>
</excludes>
</resource>
</webResources>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
Not 100% sure whether this even is the relevant part. The thing is that it was already running properly and I never changed anything on the pom.xml. Only thing could be dependency updates by the repository.

Categories