Maven plugin AbstractMojoTestCase PlexusContainerException - java

I'm trying to create a maven plugin for the first time.
everything works till now except for the testing part.
I want to write some test cases before I start at coding the plugin itself.
I've had really much trouble till now with being able to simply run a test case that doesn't even do anything itself.
I think I'm missing a dependency or that I'm using compatible versions. I've messed much with the versions and the exceptions have changed a lot. But this one keeps coming back.
So when I run mvn test I get the following response from the console:
λ mvn test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Simple Web Share Plugin 1.2.9-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # sws-maven-plugin ---
[INFO] Using '' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory maven-sws-plugin\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.2:compile (default-compile) # sws-maven-plugin ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to maven-sws-plugin\target\classes
[INFO]
[INFO] --- maven-plugin-plugin:3.2:descriptor (default-descriptor) # sws-maven-plugin ---
[INFO] Using '' encoding to read mojo metadata.
[INFO] Applying mojo extractor for language: java
[INFO] Mojo extractor for language: java found 0 mojo descriptors.
[INFO] Applying mojo extractor for language: bsh
[INFO] Mojo extractor for language: bsh found 0 mojo descriptors.
[INFO] Applying mojo extractor for language: java-annotations
[INFO] Mojo extractor for language: java-annotations found 1 mojo descriptors.
[INFO]
[INFO] --- maven-plugin-plugin:3.2:descriptor (mojo-descriptor) # sws-maven-plugin ---
[INFO] Using '' encoding to read mojo metadata.
[INFO] Applying mojo extractor for language: java
[INFO] Mojo extractor for language: java found 0 mojo descriptors.
[INFO] Applying mojo extractor for language: bsh
[INFO] Mojo extractor for language: bsh found 0 mojo descriptors.
[INFO] Applying mojo extractor for language: java-annotations
[INFO] Mojo extractor for language: java-annotations found 1 mojo descriptors.
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # sws-maven-plugin ---
[INFO] Using '' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.2:testCompile (default-testCompile) # sws-maven-plugin ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # sws-maven-plugin ---
[INFO] Surefire report directory: maven-sws-plugin\target\surefire-reports
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Running plugins.MojoTest
org.codehaus.plexus.PlexusContainerException: Cycle detected in component graph in the system:
at org.codehaus.plexus.DefaultPlexusContainer.initialize(DefaultPlexusContainer.java:624)
at org.codehaus.plexus.DefaultPlexusContainer.construct(DefaultPlexusContainer.java:281)
at org.codehaus.plexus.DefaultPlexusContainer.<init>(DefaultPlexusContainer.java:172)
at org.apache.maven.plugin.testing.AbstractMojoTestCase.setupContainer(AbstractMojoTestCase.java:159)
at org.apache.maven.plugin.testing.AbstractMojoTestCase.getContainer(AbstractMojoTestCase.java:179)
at org.apache.maven.plugin.testing.AbstractMojoTestCase.setUp(AbstractMojoTestCase.java:107)
at nl.ciber.maven.plugins.MojoTest.setUp(MojoTest.java:11)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:95)
at org.apache.maven.surefire.junit.JUnit3Provider.executeTestSet(JUnit3Provider.java:121)
at org.apache.maven.surefire.junit.JUnit3Provider.invoke(JUnit3Provider.java:98)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Caused by: org.codehaus.plexus.component.composition.CycleDetectedInComponentGraphException: Cyclic requirement detected
at org.codehaus.plexus.component.composition.DefaultCompositionResolver.addComponentDescriptor(DefaultCompositionResolver.java:65)
at org.codehaus.plexus.component.repository.DefaultComponentRepository.addComponentDescriptor(DefaultComponentRepository.java:229)
at org.codehaus.plexus.DefaultComponentRegistry.addComponentDescriptor(DefaultComponentRegistry.java:126)
at org.codehaus.plexus.DefaultPlexusContainer.addComponentDescriptor(DefaultPlexusContainer.java:514)
at org.codehaus.plexus.DefaultPlexusContainer.discoverComponents(DefaultPlexusContainer.java:969)
at org.codehaus.plexus.DefaultPlexusContainer.discoverComponents(DefaultPlexusContainer.java:941)
at org.codehaus.plexus.DefaultPlexusContainer.initialize(DefaultPlexusContainer.java:560)
... 29 more
Caused by: org.codehaus.plexus.util.dag.CycleDetectedException: Edge between 'Vertex{label='org.apache.maven.plugin.version.PluginVersionResolver:default'}' and 'Vertex{label='org.apache.maven.plugin.MavenPluginManager:default'}' introduces to cycle in the graph org.apache.maven.plugin.MavenPluginManager:default --> org.apache.maven.plugin.version.PluginVersionResolver:default --> org.apache.maven.plugin.MavenPluginManager:default
at org.codehaus.plexus.util.dag.DAG.addEdge(DAG.java:143)
at org.codehaus.plexus.util.dag.DAG.addEdge(DAG.java:123)
at org.codehaus.plexus.component.composition.DefaultCompositionResolver.addComponentDescriptor(DefaultCompositionResolver.java:60)
... 35 more
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 0.726 sec <<< FAILURE!
testFilePath(***.maven.plugins.MojoTest) Time elapsed: 0.686 sec <<< FAILURE!
junit.framework.AssertionFailedError: Failed to create plexus container.
at junit.framework.Assert.fail(Assert.java:47)
at org.apache.maven.plugin.testing.AbstractMojoTestCase.setupContainer(AbstractMojoTestCase.java:164)
at org.apache.maven.plugin.testing.AbstractMojoTestCase.getContainer(AbstractMojoTestCase.java:179)
at org.apache.maven.plugin.testing.AbstractMojoTestCase.setUp(AbstractMojoTestCase.java:107)
at ***.maven.plugins.MojoTest.setUp(MojoTest.java:11)
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.junit.JUnitTestSet.execute(JUnitTestSet.java:95)
at org.apache.maven.surefire.junit.JUnit3Provider.executeTestSet(JUnit3Provider.java:121)
at org.apache.maven.surefire.junit.JUnit3Provider.invoke(JUnit3Provider.java:98)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)
Results :
Failed tests: testFilePath(***.maven.plugins.MojoTest): Failed to create plexus container.
Tests run: 1, Failures: 1, Errors: 0, Skipped: 0
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.595 s
[INFO] Finished at: 2017-03-24T10:35:35+01:00
[INFO] Final Memory: 32M/497M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project sws-maven-plugin: There are test failures.
[ERROR]
[ERROR] Please refer to maven-sws-plugin\target\surefire-reports for the individual test results.
[ERROR] -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
My POM.xml (I've added a few things what are proberally not needed, I've googled a lot and nothing worked till now):
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>***.maven.plugin.sws</groupId>
<artifactId>sws-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>1.2.9-SNAPSHOT</version>
<name>Simple Web Share Plugin</name>
<properties>
<project.build.sourceEncoding>Cp1252</project.build.sourceEncoding>
<maven.version>3.5.0-alpha-1</maven.version>
</properties>
<repositories>
<repository>
<id>mavencentral</id>
<name>Maven Central</name>
<url>https://repo1.maven.org/maven2/</url>
<layout>default</layout>
</repository>
</repositories>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.4</version>
</plugin>
</plugins>
</reporting>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<executions>
<execution>
<id>mojo-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
</executions>
<configuration>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
</plugin>
</plugins>
<directory>${project.basedir}/target</directory>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<finalName>${project.artifactId}-${project.version}</finalName>
<testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>${project.basedir}/src/test/resources</directory>
</testResource>
</testResources>
</build>
<dependencies>
<dependency>
<groupId>org.fusesource.fabric</groupId>
<artifactId>fabric-maven-proxy</artifactId>
<version>7.0.1.fuse-084</version>
</dependency>
<dependency>
<groupId>***.webshare</groupId>
<artifactId>simple-web-share-api</artifactId>
<version>0.4</version>
</dependency>
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-api</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>${maven.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-settings</artifactId>
<version>${maven.version}</version>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.0.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
<version>3.0.8</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-container-default</artifactId>
<!--<version>1.5.5</version>-->
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-artifact</artifactId>
<version>${maven.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
<version>3.3.9</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<version>2.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>3.5.0-alpha-1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.2</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
My POM for testing:
<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>***.maven.plugins</groupId>
<artifactId>sws-maven-plugin</artifactId>
<packaging>jar</packaging>
<version>1.9.2-SNAPSHOT</version>
<name>reminder-maven-plugin Maven Mojo</name>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>***.maven.plugins</groupId>
<artifactId>sws-maven-plugin</artifactId>
<configuration>
</configuration>
<executions>
<execution>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
TestCase:
package ***.maven.plugins;
import org.apache.maven.plugin.testing.AbstractMojoTestCase;
/**
* Created by casper.hollemans on 20-3-2017.
*/
public class MojoTest extends AbstractMojoTestCase {
public void setUp() throws Exception {
super.setUp();
}
public void tearDown() throws Exception {
super.tearDown();
}
public void testFilePath() throws Exception {
}
}

So after struggling a bit more, I've been able to fix the exceptions.
The main problem wat that my POM was growing a bit big full of unnecessary dependencies. I've looked into the git of the maven clean plugin and compared my pom with the pom of the clean plugin. The main issue was, as I expected; I used the wrong versions. I'll post my current pom over here and the link to the maven plugin's git.
Maven plugins github page
Maven clean plugin (project I used to compare to).
My pom:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>***.maven.plugin.sws</groupId>
<artifactId>sws-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>1.2.9-SNAPSHOT</version>
<name>Simple Web Share Plugin</name>
<properties>
<project.build.sourceEncoding>****</project.build.sourceEncoding>
<maven.version>3.0</maven.version>
</properties>
<reporting>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.4</version>
</plugin>
</plugins>
</reporting>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.2</version>
<executions>
<execution>
<id>mojo-descriptor</id>
<goals>
<goal>descriptor</goal>
</goals>
</execution>
</executions>
<configuration>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.12</version>
<configuration>
<forkMode>never</forkMode>
</configuration>
</plugin>
</plugins>
<directory>${project.basedir}/target</directory>
<outputDirectory>${project.build.directory}/classes</outputDirectory>
<finalName>${project.artifactId}-${project.version}</finalName>
<testOutputDirectory>${project.build.directory}/test-classes</testOutputDirectory>
<sourceDirectory>${project.basedir}/src/main/java</sourceDirectory>
<testSourceDirectory>${project.basedir}/src/test/java</testSourceDirectory>
<resources>
<resource>
<directory>${project.basedir}/src/main/resources</directory>
</resource>
</resources>
<testResources>
<testResource>
<directory>${project.basedir}/src/test/resources</directory>
</testResource>
</testResources>
</build>
<dependencies>
<dependency>
<groupId>***.webshare</groupId>
<artifactId>simple-web-share-api</artifactId>
<version>0.4</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-plugin-api</artifactId>
<version>${maven.version}</version>
</dependency>
<dependency>
<groupId>jdom</groupId>
<artifactId>jdom</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.5</version>
</dependency>
<dependency>
<groupId>org.eclipse.aether</groupId>
<artifactId>aether-api</artifactId>
<version>1.1.0</version>
</dependency>
<!-- dependencies to annotations -->
<dependency>
<groupId>org.apache.maven.plugin-tools</groupId>
<artifactId>maven-plugin-annotations</artifactId>
<version>3.2</version>
<scope>provided</scope>
</dependency>
<!-- Test -->
<dependency>
<groupId>org.apache.maven.plugin-testing</groupId>
<artifactId>maven-plugin-testing-harness</artifactId>
<version>2.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${maven.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-compat</artifactId>
<version>${maven.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>

Related

Build getting succeeded, but test suite is not getting executed from pom.xml with mvn test

I am trying to execute the maven test from pom.xml . All my test are written in testng.xml file and I am able to invoke testng.xml file alone and test is getting executed as expected. But when I try to execute testng.xml from pom.xml using mvn test, though I have called testng.xml file from maven sure fire plugin, only the build is getting succeed and test is not getting executed.
Please find my pom.xml
<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.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.7.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-params</artifactId>
<version>5.7.1</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>4.0.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.testng/testng -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.3.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.11</version>
</dependency>
<!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>1.7</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>4.1.2</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>4.1.2</version>
</dependency>
<dependency>
<groupId>io.github.bonigarcia</groupId>
<artifactId>webdrivermanager</artifactId>
<version>4.2.0</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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
And below in testng.xml file :
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="Suite">
<parameter name = "DemoUrl" value = "https://xxxx.com/" />
<test thread-count="5" name="Test">
<classes>
<class name="helixpackage.Demo.CreateProjectTest">
<methods>
<include name="ProjectCreationTest" />
</methods>
</class>
</classes>
</test> <!-- Test -->
</suite> <!-- Suite -->
Below is the Folder structure:
Folder structure Image
While executing mvn test I can see only Build get succeeded and test is not triggered
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for helixpackage:EYHelix:jar:0.0.1-SNAPSHOT
[WARNING] 'build.pluginManagement.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.apache.maven.plugins:maven-compiler-plugin # line 140, column 14
[WARNING] 'build.pluginManagement.plugins.plugin.(groupId:artifactId)' must be unique but found duplicate declaration of plugin org.apache.maven.plugins:maven-surefire-plugin # line 149, column 15
[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] ------------------------< helixpackage:Demo >------------------------
[INFO] Building Demo0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:resources (default-resources) # Demo---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Jeby.Jacob\git\Demo1\Demo\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.10.0:compile (default-compile) # Demo---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.2:testResources (default-testResources) # Demo---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\Jeby.Jacob\git\Demo1\Demo\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.10.0:testCompile (default-testCompile) # Demo---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) # Demo---
[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: 4.988 s
[INFO] Finished at: 2022-02-23T20:21:28+05:30
[INFO] ------------------------------------------------------------------------
What is going wrong here. I tried to debug but not getting the exact issue.

Cucumber jvm report doesnt generating

I want to get cucumber report, but it nothing generates.
I get this error during running via mvn clean install.
I cant to resolve this issue.
I'm new in automation...
/* During run as Maven Clean Install I get mentioned below error:
[INFO] Scanning for projects...
[INFO]
[INFO] -----------------< MobWebAutomation:MobWebAutomation >------------------
[INFO] Building MobWebAutomation 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # MobWebAutomation ---
[INFO] Deleting C:\Users\Rauf.mirzoyev\eclipse-workspace_Appium\MobWebAutomation\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # MobWebAutomation ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) # MobWebAutomation ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # MobWebAutomation ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) # MobWebAutomation ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 4 source files to C:\Users\Rauf.mirzoyev\eclipse-workspace_Appium\MobWebAutomation\target\test-classes
[ERROR] /C:/Users/Rauf.mirzoyev/eclipse-workspace_Appium/MobWebAutomation/src/test/java/stepDefinitions/RegistrationWithValidCredentials.java:[116,55] unmappable character (0x8F) for encoding windows-1252
[ERROR] /C:/Users/Rauf.mirzoyev/eclipse-workspace_Appium/MobWebAutomation/src/test/java/stepDefinitions/RegistrationWithValidCredentials.java:[116,61] unmappable character (0x8F) for encoding windows-1252
[ERROR] /C:/Users/Rauf.mirzoyev/eclipse-workspace_Appium/MobWebAutomation/src/test/java/stepDefinitions/RegistrationWithValidCredentials.java:[116,64] unmappable character (0x8F) for encoding windows-1252
[INFO]
[INFO] --- maven-surefire-plugin:2.22.0:test (default-test) # MobWebAutomation ---
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) # MobWebAutomation ---
[INFO] Building jar: C:\Users\Rauf.mirzoyev\eclipse-workspace_Appium\MobWebAutomation\target\MobWebAutomation-1.0-SNAPSHOT.jar
[INFO]
[INFO] --- maven-cucumber-reporting:5.0.0:generate (execution) # MobWebAutomation ---
[INFO] About to generate Cucumber report.
Dec 29, 2021 10:31:50 AM net.masterthought.cucumber.ReportBuilder generateErrorPage
INFO: Unexpected error
net.masterthought.cucumber.ValidationException: None report file was added!
at net.masterthought.cucumber.ReportParser.parseJsonFiles(ReportParser.java:62)
at net.masterthought.cucumber.ReportBuilder.generateReports(ReportBuilder.java:88)
at net.masterthought.cucumber.CucumberReportGeneratorMojo.execute(CucumberReportGeneratorMojo.java:209)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:305)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:957)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:289)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:193)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 7.525 s
[INFO] Finished at: 2021-12-29T10:31:51+04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal net.masterthought:maven-cucumber-reporting:5.0.0:generate (execution) on project MobWebAutomation: Error Found: BUILD FAILED - Check Report For Details -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the
following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
*/
/*My 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>MobWebAutomation</groupId>
<artifactId>MobWebAutomation</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.2.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>7.0.0</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<includes>
<exclude>**/*Runner.java</exclude>
</includes>
</configuration>
</plugin>
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>5.0.0</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>MobWebAutomation</projectName>
<outputDirectory>${project.build.directory}/cucumber-reports</outputDirectory>
<enableFlashCharts>true</enableFlashCharts>
<buildNumber>42</buildNumber>
<parallelTesting>false</parallelTesting>
<inputDirectory>${project.build.directory}/cucumber-reports</inputDirectory>
<jsonFiles>
<jsonFile>**/*.json</jsonFile>
</jsonFiles>
<testFailureIgnore>true</testFailureIgnore>
<buildSuccessOnTestFailure>true</buildSuccessOnTestFailure>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
}
**Runner class**
{ package runner;
import org.junit.runner.RunWith;
import io.cucumber.junit.CucumberOptions;
import io.cucumber.junit.Cucumber;
#RunWith(Cucumber.class)
#CucumberOptions(features = { "src/test/java/features/registration.feature" },
glue = { "stepDefinitions",
"utility" }, monochrome = true, plugin = { "pretty",
"json:target/cucumber-reports/AutomationReport.json",
"json:target/cucumber-reports/cucumber.runtime.formatter.JSONFormatter"
},
dryRun = false)//, tags = "#correct or #incorrect")
public class RunTest {
}
Thank you to all, and especially to Raghav Pal, and his YouTube channel.
After all steps, it was needed to perform "clean verify". After this operation, the report has been successfully generated.
Updated 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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>MobWebAutomation</groupId>
<artifactId>MobWebAutomation</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source> /* 1.8 it's your JDK version */
<maven.compiler.target>1.8</maven.compiler.target>/* 1.8 it's your JDK version */
</properties>
<dependencies>
<dependency>
<groupId>io.appium</groupId>
<artifactId>java-client</artifactId>
<version>7.2.0</version>
</dependency>
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.1.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>7.0.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.0</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>2.8.0</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>YOUR_PROJECT_Name</projectName>
<outputDirectory>${project.build.directory}/cucumber-report-html</outputDirectory>
<cucumberOutput>${project.build.directory}/cucumber.json</cucumberOutput>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
RUNNER CLASS:
package runner;
import org.junit.runner.RunWith;
import io.cucumber.junit.CucumberOptions;
import io.cucumber.junit.Cucumber;
#RunWith(Cucumber.class)
#CucumberOptions(
features = { "src/test/java/features/registration.feature" },
glue = { "stepDefinitions", "utility" },
monochrome = true,
plugin = {
"pretty",
"json:target/Cucumber.json"
},
dryRun = false
)
public class RunTest {
//
}
After you need to clean your project -> run via mvn clear verify. That's all.
Source: YouTube video - Selenium Cucumber Java BDD Framework 12 | How To Create HTML Reports
Following Configuration helped me to resolve the issue
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>qaclickacademy</groupId>
<artifactId>RestAPIFramework</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>RestAPIFramework</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<configuration>
<testFailureIgnore>true</testFailureIgnore>
</configuration>
</plugin>
<plugin>
<groupId>net.masterthought</groupId>
<artifactId>maven-cucumber-reporting</artifactId>
<version>5.3.0</version>
<executions>
<execution>
<id>execution</id>
<phase>verify</phase>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<projectName>cucumber-jvm-example</projectName>
<jsonFiles>
<param>**/*.json</param>
</jsonFiles>
<outputDirectory>${project.build.directory}/advanced-reports</outputDirectory>
<inputDirectory>${project.build.directory}/cucumber-reports</inputDirectory>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-java -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-java</artifactId>
<version>7.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-junit -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-junit</artifactId>
<version>7.5.0</version>
<scope>test</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/io.cucumber/cucumber-core -->
<dependency>
<groupId>io.cucumber</groupId>
<artifactId>cucumber-core</artifactId>
<version>7.5.0</version>
</dependency>
</dependencies>
</project>
TestRunner Class
#RunWith(Cucumber.class)
#CucumberOptions(features="src/test/java/features", glue= {"stepDefinations"},
monochrome = true,
plugin = {"pretty",
"json:target/cucumber-reports/reports.json",
"json:target/cucumber-reports/cucumber.runtime.formatter.JSONFormatter"})
public class TestRunner {
}

mvn appengine:run fails to execute goal com.google.cloud.tools:appengine-maven-plugin:2.2.0:run mvn appengine:deploy works fine

I am following the instructions from https://cloud.google.com/appengine/docs/standard/java/building-app/static-content I can deploy my changes and check them using gcloud app browse, but I cannot make the local development environment work.
Running mvn appengine:run -DskipTests returns the following error, and trying mvn package clean beforehand doesn't change it
[INFO] Scanning for projects...
[WARNING] The project mobi.grocerymonkey.groceryapp:groceryapp:war:1.0-SNAPSHOT uses prerequisites which is only intended for maven-plugin projects but not for non maven-plugin projects. For such purposes you should use the maven-enforcer-plugin. See https://maven.apache.org/enforcer/enforcer-rules/requireMavenVersion.html
[INFO]
[INFO] --------------< mobi.grocerymonkey.groceryapp:groceryapp >--------------
[INFO] Building groceryapp 1.0-SNAPSHOT
[INFO] --------------------------------[ war ]---------------------------------
[INFO]
[INFO] --- appengine-maven-plugin:2.2.0:run (default-cli) # groceryapp ---
Feb 26, 2020 3:28:56 PM com.google.cloud.tools.appengine.operations.DevAppServerRunner run
INFO: submitting command: /usr/local/Cellar/openjdk/13.0.2+8_2/libexec/openjdk.jdk/Contents/Home/bin/java -Xdebug -Dappengine.fullscan.seconds=3 -Duse_jetty9_runtime=true -D--enable_all_permissions=true -Dappengine.sdk.root=/Users/kn/Library/Application Support/google-cloud-tools-java/managed-cloud-sdk/LATEST/google-cloud-sdk/platform/google_appengine/google/appengine/tools/java -cp /Users/kn/Library/Application Support/google-cloud-tools-java/managed-cloud-sdk/LATEST/google-cloud-sdk/platform/google_appengine/google/appengine/tools/java/lib/appengine-tools-api.jar com.google.appengine.tools.development.DevAppServerMain --allow_remote_shutdown --disable_update_check --no_java_agent /Users/kn/Documents/private/musical-funicular/groceryapp/target/groceryapp-1.0-SNAPSHOT
[INFO] GCLOUD: WARNING: An illegal reflective access operation has occurred
[INFO] GCLOUD: WARNING: Illegal reflective access by com.google.appengine.tools.development.StreamHandlerFactory (file:/Users/kn/Library/Application%20Support/google-cloud-tools-java/managed-cloud-sdk/LATEST/google-cloud-sdk/platform/google_appengine/google/appengine/tools/java/lib/impl/appengine-local-runtime.jar) to method java.net.URL.getURLStreamHandler(java.lang.String)
[INFO] GCLOUD: WARNING: Please consider reporting this to the maintainers of com.google.appengine.tools.development.StreamHandlerFactory
[INFO] GCLOUD: WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
[INFO] GCLOUD: WARNING: All illegal access operations will be denied in a future release
[INFO] GCLOUD: java.lang.RuntimeException: Unable to create a DevAppServer
[INFO] GCLOUD: at com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:369)
[INFO] GCLOUD: at com.google.appengine.tools.development.DevAppServerFactory.createDevAppServer(DevAppServerFactory.java:301)
[INFO] GCLOUD: at com.google.appengine.tools.development.DevAppServerMain$StartAction.apply(DevAppServerMain.java:383)
[INFO] GCLOUD: at com.google.appengine.tools.util.Parser$ParseResult.applyArgs(Parser.java:45)
[INFO] GCLOUD: at com.google.appengine.tools.development.DevAppServerMain.run(DevAppServerMain.java:257)
[INFO] GCLOUD: at com.google.appengine.tools.development.DevAppServerMain.main(DevAppServerMain.java:248)
[INFO] GCLOUD: Caused by: java.lang.ExceptionInInitializerError
[INFO] GCLOUD: at com.google.appengine.tools.development.DevAppServerImpl.<init>(DevAppServerImpl.java:124)
[INFO] GCLOUD: at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
[INFO] GCLOUD: at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
[INFO] GCLOUD: at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
[INFO] GCLOUD: at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
[INFO] GCLOUD: at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
[INFO] GCLOUD: at com.google.appengine.tools.development.DevAppServerFactory.doCreateDevAppServer(DevAppServerFactory.java:354)
[INFO] GCLOUD: ... 5 more
[INFO] GCLOUD: Caused by: java.lang.IllegalStateException: java.lang.NoSuchMethodException: java.net.SocksSocketImpl.<init>()
[INFO] GCLOUD: at com.google.appengine.tools.development.DevSocketImplFactory.<clinit>(DevSocketImplFactory.java:76)
[INFO] GCLOUD: ... 12 more
[INFO] GCLOUD: Caused by: java.lang.NoSuchMethodException: java.net.SocksSocketImpl.<init>()
[INFO] GCLOUD: at java.base/java.lang.Class.getConstructor0(Class.java:3350)
[INFO] GCLOUD: at java.base/java.lang.Class.getDeclaredConstructor(Class.java:2554)
[INFO] GCLOUD: at com.google.appengine.tools.development.DevSocketImplFactory.<clinit>(DevSocketImplFactory.java:72)
[INFO] GCLOUD: ... 12 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.892 s
[INFO] Finished at: 2020-02-26T15:28:57+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.google.cloud.tools:appengine-maven-plugin:2.2.0:run (default-cli) on project groceryapp: Failed to run devappserver: com.google.cloud.tools.appengine.operations.cloudsdk.process.ProcessHandlerException: com.google.cloud.tools.appengine.AppEngineException: Non zero exit: 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Kristians-MacBook-Air:groceryapp kn$
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<groupId>mobi.grocerymonkey.groceryapp</groupId>
<artifactId>groceryapp</artifactId>
<properties>
<!-- uncomment if you wish to set your project here project- gcloud is used otherwise -->
<!-- <app.deploy.project>enduring-trees-259812</app.deploy.project> -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.showDeprecation>true</maven.compiler.showDeprecation>
<archiveClasses>true</archiveClasses>
</properties>
<prerequisites>
<maven>3.5</maven>
</prerequisites>
<dependencies>
<!-- Compile/runtime dependencies -->
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-1.0-sdk</artifactId>
<version>1.9.78</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>4.0.1</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-testing</artifactId>
<version>1.9.78</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-stubs</artifactId>
<version>1.9.78</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-tools-sdk</artifactId>
<version>1.9.78</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.truth</groupId>
<artifactId>truth</artifactId>
<version>1.0.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.6.0</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>2.0.2-beta</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.googlecode.objectify</groupId>
<artifactId>objectify</artifactId>
<version>6.0.6</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20190722</version>
</dependency>
</dependencies>
<build>
<!-- for hot reload of the web application-->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>2.2.0</version>
<configuration>
<project>enduring-trees-259812</project>
<version>1</version>
<jvmFlags>
<jvmFlag>-Xdebug</jvmFlag>
<jvmFlag>-Dappengine.fullscan.seconds=3</jvmFlag>
</jvmFlags>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.7</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>display-dependency-updates</goal>
<goal>display-plugin-updates</goal>
</goals>
</execution>
</executions>
<configuration>
<excludes>
<exclude>javax.servlet:javax.servlet-api</exclude>
<exclude>com.google.guava:guava</exclude> <!-- avoid android version -->
</excludes>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.2.3</version>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>3.0.0-M1</version>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M4</version>
</plugin>
<plugin>
<artifactId>maven-site-plugin</artifactId>
<version>3.8.2</version>
</plugin>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin>
<plugin>
<artifactId>maven-deploy-plugin</artifactId>
<version>3.1</version>
</plugin>
<plugin>
<artifactId>maven-enforcer-plugin</artifactId>
<version>3.0.0-M3</version>
<executions>
<execution>
<id>enforce-maven</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireMavenVersion>
<version>3.5</version>
</requireMavenVersion>
<requirePluginVersions>
<message>Best Practice is to always define plugin versions!</message>
<banLatest>true</banLatest>
<banRelease>true</banRelease>
<phases>clean,deploy,verify,appengine:run,appengine:deploy,appengine:update,appengine:devappaserver,site</phases>
</requirePluginVersions>
</rules>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
appengine-web.xml
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<runtime>java8</runtime>
<threadsafe>true</threadsafe>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
</system-properties>
<static-files>
<include path="/**.html"></include>
</static-files>
</appengine-web-app>
mvn clean install -U has been run
I had the same build error because of using unmatched JDK version.
Check your JDK version with "java -version". Probably you should use Java8(Java1.8) instead of Open JDK13.

Generate exe with launch4j with maven Project

I have to try generating .exe file Using Maven Project. I get a correct jar with my dependencies but i dont get an exe file. Is there something else to do?.
But it will always showing launch4j exception like,
[INFO] Replacing D:\SpiralUpWorkspace\SpiralShareAutoTaskAllocation\target\SpiralShareAutoTaskAllocation-0.0.1-SNAPSHOT.jar with D:\SpiralUpWorkspace\SpiralShareAutoTaskAllocation\target\SpiralShareAutoTaskAllocation-0.0.1-SNAPSHOT-shaded.jar
[INFO]
[INFO] --- launch4j-maven-plugin:1.7.21:launch4j (l4j-clui) # SpiralShareAutoTaskAllocation ---
[INFO] Platform-specific work directory already exists: C:\Users\Admin\.m2\repository\net\sf\launch4j\launch4j\3.11\launch4j-3.11-workdir-win32
[ERROR]
net.sf.launch4j.BuilderException: Application jar doesn't exist.
at net.sf.launch4j.Builder.build(Builder.java:76)
at com.akathist.maven.plugins.launch4j.Launch4jMojo.execute(Launch4jMojo.java:403)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:862)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:286)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:197)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.920 s
[INFO] Finished at: 2017-12-29T12:30:13+05:30
[INFO] Final Memory: 15M/46M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.akathist.maven.plugins.launch4j:launch4j-maven-plugin:1.7.21:launch4j (l4j-clui) on project SpiralShareAutoTaskAllocation: Failed to build the executable; please verify your configuration. Application jar doesn't exist. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
My pom.xml 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>com.spiralshare.autoallocation</groupId>
<artifactId>SpiralShareAutoTaskAllocation</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>SpiralShareAutoAllocation</name>
<description>SpiralShare Task Auto Allocation</description>
<url>http://maven.apache.org</url>
<properties>
<!-- Generic properties -->
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Spring -->
<spring-framework.version>4.0.3.RELEASE</spring-framework.version>
<!-- Hibernate / JPA -->
<!-- <hibernate.version>4.3.5.Final</hibernate.version> -->
<hibernate.version>3.6.9.Final</hibernate.version>
<!-- Logging -->
<logback.version>1.0.13</logback.version>
<slf4j.version>1.7.5</slf4j.version>
</properties>
<dependencies>
<!-- Commons -->
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<!-- Spring and Transactions -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring-framework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring-framework.version}</version>
</dependency>
<!-- Spring ORM support -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring-framework.version}</version>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>${hibernate.version}</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.9</version>
</dependency>
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>1.7.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<executions>
<execution>
<id>l4j-clui</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>gui</headerType>
<jar>${project.build.directory}/${artifactId}-${version}-shaded.jar</jar>
<outfile>${project.build.directory}/SpiralShareAutoAllocation.exe</outfile>
<downloadUrl>http://java.com/download</downloadUrl>
<classPath>
<mainClass>com.spiralshare.autoallocation.AutoAllocationMain</mainClass>
<preCp>anything</preCp>
</classPath>
<icon>application.ico</icon>
<jre>
<minVersion>1.8</minVersion>
<jdkPreference>preferJre</jdkPreference>
</jre>
<versionInfo>
<fileVersion>1.0.0.0</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<fileDescription>${project.name}</fileDescription>
<copyright>2017 spiraluplabs.com</copyright>
<productVersion>1.0.0.0</productVersion>
<txtProductVersion>1.0.0.0</txtProductVersion>
<productName>${project.name}</productName>
<companyName>SpiralUp</companyName>
<internalName>SpiralShareAutoAllocation</internalName>
<originalFilename>SpiralShareAutoAllocation.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
I did some mistake in my pom.xml file, But I don't know..
Pls, let me know your suggestion..
Thank you.
Check this answer: https://stackoverflow.com/a/4088861/5572007
You shouldn't use "-shaded" suffix.
Quote: "[Shaded plugin] normally renames that jar to target/original-artifact-version.jar, and gives the shaded JAR the name target/artifact-version.jar". You can check your target folder for names of generated jar files.
Check that jar file corresponding to template really exists:
${project.build.directory}/${artifactId}-${version}-shaded.jar
You can replace this template to hardcoded full path to jar file and run build to verify all correct.

Maven tomcat7 exec-war-only Error

I want to create an executable war/jar like explained in the tomcat7-maven-plugin documentation: http://tomcat.apache.org/maven-plugin-2.2/executable-war-jar.html
But i get a build failure (NullPointerException):
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Gothic Mod Manager 0.1.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> tomcat7-maven-plugin:2.2:exec-war (default-cli) # gmm >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # gmm ---
[INFO] Using 'ISO-8859-1' encoding to copy filtered resources.
[INFO] Copying 3 resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # gmm ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # gmm ---
[INFO] Not copying test resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # gmm ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # gmm ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) # gmm ---
[INFO] Packaging webapp
[INFO] Assembling webapp [gmm] in [C:\***\GMM\target\gmm-0.1.1-SNAPSHOT]
[INFO] Processing war project
[INFO] Copying webapp resources [C:\***\GMM\src\main\webapp]
[INFO] Webapp assembled in [963 msecs]
[INFO] Building war: C:\***\GMM\target\gmm-0.1.1-SNAPSHOT.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:exec-war-only (executable) # gmm ---
[INFO]
[INFO] <<< tomcat7-maven-plugin:2.2:exec-war (default-cli) # gmm <<<
[INFO]
[INFO] --- tomcat7-maven-plugin:2.2:exec-war (default-cli) # gmm ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.854s
[INFO] Finished at: Mon Jun 09 18:55:09 CEST 2014
[INFO] Final Memory: 30M/223M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:exec-war (default-cli) on project gmm: Execution default-cli of goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:exec-war failed. NullPointerException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:exec-war (default-cli) on project gmm: Execution default-cli of goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:exec-war failed.
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:224)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
at org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:317)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:152)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:555)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:214)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:158)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
at org.codehaus.classworlds.Launcher.main(Launcher.java:46)
Caused by: org.apache.maven.plugin.PluginExecutionException: Execution default-cli of goal org.apache.tomcat.maven:tomcat7-maven-plugin:2.2:exec-war failed.
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:115)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208)
... 20 more
Caused by: java.lang.NullPointerException
at java.io.FileInputStream.<init>(FileInputStream.java:134)
at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractExecWarMojo.execute(AbstractExecWarMojo.java:301)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:106)
... 21 more
[ERROR]
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException
The goals tomcat7:deploy, :redeploy, :undeploy and the startup of a local embedded server with tomcat7:run work as expected.
Unlike the documentation i linked above i only have a single .pom file, so i merged the parts from the docu together. My pom now 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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.gothic-reloaded-mod</groupId>
<artifactId>gmm</artifactId>
<packaging>war</packaging>
<version>0.1.1-SNAPSHOT</version>
<name>Gothic Mod Manager</name>
<url>https://github.com/Katharsas/GMM</url>
<properties>
<org.springframework.version>4.0.4.RELEASE</org.springframework.version>
<org.springframework.security.version>3.2.0.RELEASE</org.springframework.security.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.imgscalr</groupId>
<artifactId>imgscalr-lib</artifactId>
<version>4.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.4.7</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-juli</artifactId>
<version>7.0.52</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-core</artifactId>
<version>${org.springframework.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${org.springframework.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${org.springframework.security.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-taglibs</artifactId>
<version>${org.springframework.security.version}</version>
</dependency>
<!-- Apache Commons Upload -->
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
</dependency>
<!-- Apache Commons Upload -->
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>1.3</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
</plugin>
</plugins>
</pluginManagement>
<resources>
<resource>
<directory>src/main/resources</directory>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<configuration>
<path>/GMM</path>
<encoding>UTF-8</encoding>
<username>admin</username>
<password>**********</password>
</configuration>
<executions>
<execution>
<id>executable</id>
<goals>
<goal>exec-war-only</goal>
<goal>exec-war</goal>
</goals>
<phase>package</phase>
<configuration>
<enableNaming>true</enableNaming>
<warRunDependencies>
<warRunDependency>
<dependency>
<groupId>de.gothic-reloaded-mod</groupId>
<artifactId>gmm</artifactId>
<version>0.1.1-SNAPSHOT</version>
<type>war</type>
</dependency>
<contextPath>/</contextPath>
</warRunDependency>
</warRunDependencies>
<extraDependencies>
<extraDependency>
<groupId>org.apache.derby</groupId>
<artifactId>derby</artifactId>
<version>10.1.3.1</version>
</extraDependency>
<extraDependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.4</version>
</extraDependency>
</extraDependencies>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<configuration>
<encoding>ISO-8859-1</encoding>
</configuration>
</plugin>
</plugins>
</build>
</project>
Additional info: Im using Eclipse Kepler, my Run Configuration looks like this:
tomcat7:exec-war -e
I also tried with the commando line, tried :exec-war-only but nothing worked.
I searched and tried different things for days now, so any help is much appreciated! : ]
The NPE is because the plugin does not find the packaged war file, I fixed that error by explicitly adding the package phase to the build, so for example:
mvn clean package tomcat7:exec-war
any phase that produce the war package fits well for avoiding the NPE: package, install, deploy, etc.
So, in your case, where you use a Run Configuration in Eclipse, just add package before tomcat7:exec-war -e
I have a similar issue with version 2.2 of the plugin, but I got it run with 2.1 according to this tutorial.
There is a version 2.3 now where the problem from 2.2 has been fixed!
(had some problems with 2.1 because it is so old)
Sadly its only a snapshot version and needs to be fetched from Apache Snapshots Repository. To get it you need to put this into your pom:
<pluginRepositories>
<pluginRepository>
<id>apache.snapshots</id>
<name>Apache Snapshots</name>
<url>http://repository.apache.org/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
Then you can use the new version <version>2.3-SNAPSHOT</version>
I received this error with spring boot application. I had to spend quite sometime so putting it here that below plugin needs to be included
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
Also packaging type should be jar
<packaging>jar</packaging>
Start-class should be defined as your main class
<start-class>com.edu.schoolT.SchoolWeb</start-class>
main class or class annotated with #SpringBootApplication should extend SpringBootServletInitializer. For further info...
Create a deployable war file
I have fixed similar issue in my project and given reference below link
tomcat7-maven-plugin custom server.xml
Find pom.xml changes for this issue

Categories