Error to run a Maven with JUnit project in Eclipse - java

When I am trying to run a Maven with JUnit test in an eclipse project I've got this ERROR below:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building exemplo-maven 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # exemplo-maven ---
[INFO] Deleting C:\Users\vcamargo\workspace\exemplo-maven\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # exemplo-maven ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # exemplo-maven ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\vcamargo\workspace\exemplo-maven\target\classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # exemplo-maven ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # exemplo-maven ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\vcamargo\workspace\exemplo-maven\target\test-classes
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # exemplo-maven ---
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-booter/2.12.4/surefire-booter-2.12.4.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/maven-surefire-common/2.12.4/maven-surefire-common-2.12.4.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/reporting/maven-reporting-api/2.0.9/maven-reporting-api-2.0.9.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/maven-toolchain/2.0.9/maven-toolchain-2.0.9.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-annotations/3.1/maven-plugin-annotations-3.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.470 s
[INFO] Finished at: 2017-02-27T10:08:30-03:00
[INFO] Final Memory: 19M/153M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test (default-test) on project exemplo-maven: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.12.4:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.12.4 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-surefire-plugin:jar:2.12.4 -> org.apache.maven.surefire:surefire-booter:jar:2.12.4: Failed to read artifact descriptor for org.apache.maven.surefire:surefire-booter:jar:2.12.4: Could not transfer artifact org.apache.maven.surefire:surefire-booter:pom:2.12.4 from/to central (https://repo.maven.apache.org/maven2): RSA premaster secret error: SunTls12RsaPremasterSecret KeyGenerator not available -> [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/PluginResolutionException
Following my pom.xml below:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.algaworks.curso</groupId>
<artifactId>exemplo-maven</artifactId>
<version>1.0.0-SNAPSHOT</version>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.3</version>
<executions>
<execution>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<killAfter>-1</killAfter>
<mainClass>com.algaworks.curso.Main</mainClass>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
My main class:
package com.algaworks.curso;
public class Main {
public static void main(String[] args) {
System.out.println("Hello Maven");
}
}
And finally my test class:
package com.algaworks.curso;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
public class FibonacciTest {
#Test
public void deve_retornar_fibonacci_posicao_1() {
assertEquals(1L, 1L);
}
}
When I run my test class individually it runs perfect. And if I try to run a Maven project without test (goal: exec:java) it runs perfect too.
The error occur just when I try to run the Maven project with the JUnit test (goal: clean project).

Error says dependencies which are directly or indirectly used by surefire plug-in can not be resolved. i never had this error but, delete your maven-surefire-plugin folder from location : ".m2\repository\org\apache\maven\plugins"
and re-run the build which will automatically re-download all the plugin files.
make sure to have aback up of the folder before deleting so that you can analyse what were missing.

From the logs you've posted it seems like issue is not with your JUnit test cases, but with your maven not able to download few artifacts..In the repo I could see a maven surefire booter jar of required version..I guess there is some issue with network firewalls or connectivity...can we try reconnecting to network and then running a goal ?

Related

Maven Build Profile Issue on Ubuntu WSL

I was working in a spring boot project on a Ubuntu 20.04 installed in dual boot and everything was fine. Now I pulled the repo in a Ubuntu 20.04 running on WSL(windows 11) and now the project fails to build.
I build with the command: mvn spring-boot:run -Dspring.profiles.active=dev
The error is:
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO]
[INFO] -------------------< com.robocup.olimpo:olimpo-api >--------------------
[INFO] Building olimpo-api 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:2.6.1:run (default-cli) > test-compile # olimpo-api >>>
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:resources (default-resources) # olimpo-api ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] Copying 3 resources
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) # olimpo-api ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.2.0:testResources (default-testResources) # olimpo-api ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Using 'UTF-8' encoding to copy filtered properties files.
[INFO] skip non existing resourceDirectory /home/raicorreia/olimposystem/API/src/test/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) # olimpo-api ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< spring-boot-maven-plugin:2.6.1:run (default-cli) < test-compile # olimpo-api <<<
[INFO]
[INFO]
[INFO] --- spring-boot-maven-plugin:2.6.1:run (default-cli) # olimpo-api ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.250 s
[INFO] Finished at: 2021-12-23T11:24:23-03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.6.1:run (default-cli) on project olimpo-api: Unable to parse configuration of mojo org.springframework.boot:spring-boot-maven-plugin:2.6.1:run for parameter profiles: Basic element 'profile' must not contain child elements -> [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/PluginConfigurationException
What I think is causing this is the profiles configuration on pom.xml, which was fine in Ubuntu 20.04 fully installed and fails in WSL.
Apache Maven version: 3.6.3(on both)
Java JDK Version: 11.0.3(on normal ubuntu) and 11.0.13(on wsl ubuntu)
I wroten this pom.xml based on this tutorial, I don't know if there's a better way of doing it, to have 3 application.properties file for dev, test and prod https://www.baeldung.com/maven-profiles
Any idea why is this happening?
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<profiles>
<profile>
<id>dev</id>
<properties>
<activatedProperties>dev</activatedProperties>
</properties>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>test</id>
<properties>
<activatedProperties>test</activatedProperties>
</properties>
</profile>
<profile>
<id>prod</id>
<properties>
<activatedProperties>prod</activatedProperties>
</properties>
</profile>
</profiles>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>

Aspectj class is not found by test class when running test with maven

I have created a test for my aspectj class.
When I execute my test it works fine to "Run as TestNG" from Eclipse.
Then when I execute it in maven:
mvn clean test
I get the following error:
[15:15] [eraonel/git/java-runtime-stats] -> mvn clean test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building java-runtime-stats 0.0.1
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # java-runtime-stats ---
[INFO] Deleting /repo/eraonel/git/java-runtime-stats/target
[INFO]
[INFO] --- maven-antrun-plugin:1.8:run (default) # java-runtime-stats ---
[INFO] Executing tasks
main:
[echo] BUILDING : /repo/eraonel/git/java-runtime-stats/src/main/java/com/company/commonlibrary/javaruntimestats/Version.java
[echo] BUILD 2018-10-24 13:18 UTC : /repo/eraonel/git/java-runtime-stats/src/main/java/com/company/commonlibrary/javaruntimestats/Version.java
[INFO] Executed tasks
[INFO]
[INFO] --- maven-java-formatter-plugin:0.6.1-threadsafe:format (default) # java-runtime-stats ---
[INFO] Using 'UTF-8' encoding to format source files.
[INFO] Number of files to be formatted: 21
[INFO] Successfully formatted: 1 file(s)
[INFO] Fail to format : 0 file(s)
[INFO] Skipped : 20 file(s)
[INFO] Approximate time taken: 0s
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # java-runtime-stats ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /repo/eraonel/git/java-runtime-stats/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:compile (default-compile) # java-runtime-stats ---
[INFO] Compiling 15 source files to /repo/eraonel/git/java-runtime-stats/target/classes
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # java-runtime-stats ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 11 resources
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.8.0:testCompile (default-testCompile) # java-runtime-stats ---
[INFO] Compiling 6 source files to /repo/eraonel/git/java-runtime-stats/target/test-classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /repo/eraonel/git/java-runtime-stats/src/test/java/com/company/commonlibrary/javaruntimestats/aspects/DeprecatedMethodsAspectTest.java:[17,13] cannot find symbol
symbol: class DeprecatedMethodsAspect
location: class com.company.commonlibrary.javaruntimestats.aspects.DeprecatedMethodsAspectTest
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.127 s
[INFO] Finished at: 2018-10-24T15:18:08+02:00
[INFO] Final Memory: 33M/730M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:testCompile (default-testCompile) on project java-runtime-stats: Compilation failure
[ERROR] /repo/eraonel/git/java-runtime-stats/src/test/java/com/company/commonlibrary/javaruntimestats/aspects/DeprecatedMethodsAspectTest.java:[17,13] cannot find symbol
[ERROR] symbol: class DeprecatedMethodsAspect
[ERROR] location: class com.company.commonlibrary.javaruntimestats.aspects.DeprecatedMethodsAspectTest
[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
What am I missing here?
Why is the aspectj not compiled before the test case?
Is there a way to change this?
I used this example ( for the library part) to follow since I am creating a lib that should be used for other applications:
AspectJ: How to weave an aspect library into a Java project
TestClass:
/**
* Unit test to see if pointcut works as expected in ${#link DeprecatedMethodsAspect}
*/
public class DeprecatedMethodsAspectTest {
private DeprecatedMethodsAspect aspect;
private DeprecatedMethods deprecatedMethodsMock;
private DeprecatedMethodsApp app;
#BeforeClass
public void setUp() throws Exception {
app = new DeprecatedMethodsApp();
deprecatedMethodsMock = mock(DeprecatedMethods.class);
when(deprecatedMethodsMock.isActive()).thenReturn(true);
aspect = Aspects.aspectOf(DeprecatedMethodsAspect.class);
aspect.setDeprecatedMethods(deprecatedMethodsMock);
}
#Test
public void testSumIsMatched() throws Throwable {
app.sum(1, 2);
verify(deprecatedMethodsMock, times(1)).collect(any(JoinPoint.class));
}
#Test(description = " we should not gather information from methods annotated #Beta.")
public void testSubIsNotMatched() throws Throwable {
app.sub(2, 1);
verify(deprecatedMethodsMock, times(0)).collect(any(JoinPoint.class));
}
}
This is excerpt from my pom.xml
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- Compile scope dependencies -->
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>${guava.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>${testng.version}</version>
</dependency>
</dependencies>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.3</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<!-- IMPORTANT -->
<useIncrementalCompilation>false</useIncrementalCompilation>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
<version>${java.version}</version>
<configuration>
<showWeaveInfo>true</showWeaveInfo>
<source>${java.version}</source>
<target>${java.version}</target>
<Xlint>ignore</Xlint>
<complianceLevel>${java.version}</complianceLevel>
<encoding>${project.build.sourceEncoding}</encoding>
<!--<verbose>true</verbose> -->
<!--<warn>constructorName,packageDefaultMethod,deprecation,maskedCatchBlocks,unusedLocals,unusedArguments,unusedImport</warn> -->
</configuration>
<executions>
<execution>
<!-- IMPORTANT -->
<phase>process-sources</phase>
<goals>
<goal>compile</goal>
<goal>test-compile</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjtools</artifactId>
<version>${aspectj.version}</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</pluginManagement>
</build>
You've included the aspectj-maven-plugin in <pluginManagement/> but you haven't included it in <plugins>
Try adding:
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>aspectj-maven-plugin</artifactId>
</plugin>
</plugins>
under the <build/> element.
See also: Maven: What is pluginManagement?

Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.6:jar

I am working on an end-to-end project which includes backend and frontend. The frontend works fine (angular2 framework, the 'npm start' and 'ng build' works). However, when I run 'mvn clean install' from the project home folder, it gives me an error where I have no clue:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.6:jar (default-jar) on project frontend: Error assembling JAR: Failed to determine inclusion status for: .\frontend\pom.xml: The request is not supported. -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: ...
Under the project home folder, I can run 'mvn compile' successfully, but not 'mvn clean install'. It shows frontend Failure with the error message above, backend Skip.
The maven settings.xml is the original one. I have correct setting of Java Home.
Can you help me?
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>com.xlinq.gtool</groupId>
<artifactId>parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>parent</name>
<description>Demo project for X-LinQ Graphical Tool</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.6.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
</properties>
<modules>
<module>frontend</module>
<module>backend</module>
</modules>
</project>
fronted 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>
<artifactId>frontend</artifactId>
<name>frontend</name>
<description>The X-LinQ frontend project</description>
<parent>
<groupId>com.xlinq.gtool</groupId>
<artifactId>parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>com.github.eirslett</groupId>
<artifactId>frontend-maven-plugin</artifactId>
<version>1.3</version>
<configuration>
<nodeVersion>v6.10.3</nodeVersion>
<npmVersion>3.10.10</npmVersion>
<workingDirectory>src/main/frontend</workingDirectory>
</configuration>
<executions>
<execution>
<id>install node and npm</id>
<goals>
<goal>install-node-and-npm</goal>
</goals>
</execution>
<execution>
<id>npm install</id>
<goals>
<goal>npm</goal>
</goals>
</execution>
<execution>
<id>npm run build</id>
<goals>
<goal>npm</goal>
</goals>
<configuration>
<arguments>run build</arguments>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<resource>
<directory>target/frontend</directory>
<targetPath>static</targetPath>
</resource>
</resources>
</build>
</project>
Response:
> mvn clean install
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO]
[INFO] parent
[INFO] frontend
[INFO] backend
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building parent 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) # parent ---
[INFO]
[INFO] --- maven-install-plugin:2.5.2:install (default-install) # parent ---
[INFO] Installing H:\project\pom.xml to C:\Users\x\.m2\repository\com\xlinq\gtool\parent\0.0.1-SNAPSHOT\parent-0.0.1-SNAPSHOT.pom
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building frontend 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) # frontend ---
[INFO] Deleting H:\project\frontend\target
[INFO]
[INFO] --- frontend-maven-plugin:1.3:install-node-and-npm (install node and npm) # frontend ---
[INFO] Node v6.10.3 is already installed.
[INFO] NPM 3.10.10 is already installed.
[INFO]
[INFO] --- frontend-maven-plugin:1.3:npm (npm install) # frontend ---
[INFO] Running 'npm install' in H:\project\frontend\src\main\frontend
[WARNING] npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules\chokidar\node_modules\fsevents):
[WARNING] npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
[INFO]
[INFO] --- frontend-maven-plugin:1.3:npm (npm run build) # frontend ---
[INFO] Running 'npm run build' in H:\project\frontend\src\main\frontend
[INFO]
[INFO] > gtool#0.0.0 build H:\project\frontend\src\main\frontend
[INFO] > ng build
[INFO]
[INFO] Hash: 46436a79c4d4bc172d29
[INFO] Time: 52660ms
[INFO] chunk {0} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 177 kB {5} [initial] [rendered]
[INFO] chunk {1} main.bundle.js, main.bundle.js.map (main) 104 kB {4} [initial] [rendered]
[INFO] chunk {2} styles.bundle.js, styles.bundle.js.map (styles) 270 kB {5} [initial] [rendered]
[INFO] chunk {3} scripts.bundle.js, scripts.bundle.js.map (scripts) 733 kB {5} [initial] [rendered]
[INFO] chunk {4} vendor.bundle.js, vendor.bundle.js.map (vendor) 6.01 MB [initial] [rendered]
[INFO] chunk {5} inline.bundle.js, inline.bundle.js.map (inline) 0 bytes [entry] [rendered]
[ERROR]
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # frontend ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 36 resources to static
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # frontend ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # frontend ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory H:\project\frontend\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # frontend ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.18.1:test (default-test) # frontend ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-jar-plugin:2.6:jar (default-jar) # frontend ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] parent ............................................. SUCCESS [ 0.350 s]
[INFO] frontend ........................................... FAILURE [03:06 min]
[INFO] backend ............................................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:07 min
[INFO] Finished at: 2017-08-16T15:27:21+02:00
[INFO] Final Memory: 21M/357M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:2.6:jar (default-jar) on project frontend: Error assembling JAR: Failed to determine inclusion status for: H:\project\frontend\pom.xml: H:\project\frontend\pom.xml: The request is not supported. -> [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
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn <goals> -rf :frontend
I solved this problem. Nothing wrong with the POM and Maven settings.xml. The problem is that the project was mounted in a network location. After moving it to a local hard disk drive, the mvn clean install works.
Sadly a mounted WSL drive is considered a network mount as well as that is where I'm seeing it.
Failed to execute goal org.apache.maven.plugins:maven-jar-plugin:3.2.0:jar
and
Error assembling JAR: Failed to determine inclusion status for
were messages that I am seeing. This was not a problem with previous versions of the maven-jar-plugin (2.5)

Java Web app gives build failure while deploying to Heroku

I've created a simple Web app from jersey archetype in Eclipse and followed the tutorial given here, but the command mvn -e heroku:deploy-war throws the following errors
$ mvn -e heroku:deploy-war
[INFO] Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building wallpost 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> heroku-maven-plugin:1.1.1:deploy-war (default-cli) > package # wallpost >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # wallpost ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) # wallpost ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # wallpost ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\Workspace For Java\wallpost\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) # wallpost ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) # wallpost ---
[INFO] No tests to run.
[INFO]
[INFO] --- maven-war-plugin:2.2:war (default-war) # wallpost ---
[INFO] Packaging webapp
[INFO] Assembling webapp [wallpost] in [D:\Workspace For Java\wallpost\target\wallpost]
[INFO] Processing war project
[INFO] Copying webapp resources [D:\Workspace For Java\wallpost\src\main\webapp]
[INFO] Webapp assembled in [187 msecs]
[INFO] Building war: D:\Workspace For Java\wallpost\target\wallpost.war
[INFO] WEB-INF\web.xml already added, skipping
[INFO]
[INFO] --- maven-dependency-plugin:2.3:copy-dependencies (copy-dependencies) # wallpost ---
[INFO] hk2-api-2.5.0-b05.jar already exists in destination.
[INFO] jersey-guava-2.23.2.jar already exists in destination.
[INFO] hk2-utils-2.5.0-b05.jar already exists in destination.
[INFO] javassist-3.20.0-GA.jar already exists in destination.
[INFO] osgi-resource-locator-1.0.1.jar already exists in destination.
[INFO] jersey-server-2.23.2.jar already exists in destination.
[INFO] jersey-client-2.23.2.jar already exists in destination.
[INFO] javax.ws.rs-api-2.0.1.jar already exists in destination.
[INFO] hk2-locator-2.5.0-b05.jar already exists in destination.
[INFO] jersey-container-servlet-core-2.23.2.jar already exists in destination.
[INFO] jersey-common-2.23.2.jar already exists in destination.
[INFO] validation-api-1.1.0.Final.jar already exists in destination.
[INFO] aopalliance-repackaged-2.5.0-b05.jar already exists in destination.
[INFO] jersey-media-jaxb-2.23.2.jar already exists in destination.
[INFO] javax.inject-2.5.0-b05.jar already exists in destination.
[INFO] javax.annotation-api-1.2.jar already exists in destination.
[INFO]
[INFO] --- maven-dependency-plugin:2.3:copy (default) # wallpost ---
[INFO] Configured Artifact: com.github.jsimone:webapp-runner:8.0.30.2:jar
[INFO] com.github.jsimone:webapp-runner:8.0.30.2:jar already exists in D:\Workspace For Java\wallpost\target\dependency
[INFO]
[INFO] <<< heroku-maven-plugin:1.1.1:deploy-war (default-cli) < package # wallpost <<<
[INFO]
[INFO] --- heroku-maven-plugin:1.1.1:deploy-war (default-cli) # wallpost ---
[INFO] Configured Artifact: com.github.jsimone:webapp-runner:8.0.30.2:jar
[INFO] com.github.jsimone:webapp-runner:8.0.30.2:jar already exists in D:\Workspace For Java\wallpost\target\dependency
[INFO] -----> Packaging application...
[INFO] - app: immense-beach-86309t
[INFO] - including: target/dependency/webapp-runner.jar
[INFO] - including: target/wallpost.war
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 14.865 s
[INFO] Finished at: 2016-10-17T02:43:01+05:30
[INFO] Final Memory: 26M/225M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.heroku.sdk:heroku-maven-plugin:1.1.1:deploy-war (default-cli) on project wallpost: Failed to deploy application: Not Found -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.heroku.sdk:heroku-maven-plugin:1.1.1:deploy-war (default-cli) on project wallpost: Failed to deploy application
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
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:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
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)
Caused by: org.apache.maven.plugin.MojoFailureException: Failed to deploy application
at com.heroku.sdk.maven.DeployWarMojo.execute(DeployWarMojo.java:26)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: org.apache.http.client.HttpResponseException: Not Found
at com.heroku.sdk.deploy.utils.RestClient.handleResponse(RestClient.java:172)
at com.heroku.sdk.deploy.utils.RestClient.get(RestClient.java:66)
at com.heroku.sdk.deploy.ConfigVars.getConfigVars(ConfigVars.java:41)
at com.heroku.sdk.deploy.ConfigVars.merge(ConfigVars.java:24)
at com.heroku.sdk.deploy.Deployer.mergeConfigVars(Deployer.java:106)
at com.heroku.sdk.deploy.Deployer.deploy(Deployer.java:68)
at com.heroku.sdk.deploy.App.deploy(App.java:57)
at com.heroku.sdk.deploy.App.deploy(App.java:61)
at com.heroku.sdk.deploy.WarApp.deploy(WarApp.java:30)
at com.heroku.sdk.maven.DeployWarMojo.execute(DeployWarMojo.java:22)
... 22 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/MojoFailureException
I have also tried the suggestions mentioned here, here, here and here, but they were of no use. I made sure the app name on Heroku matched the <appName></appName> in pom.xml, but that too didn't solve the problem.
Following is my pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.auro.assignment</groupId>
<artifactId>wallpost</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>wallpost</name>
<build>
<finalName>wallpost</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.3</version>
<executions>
<execution>
<id>copy-dependencies</id>
<phase>package</phase>
<goals><goal>copy-dependencies</goal></goals>
</execution>
<execution>
<phase>package</phase>
<goals><goal>copy</goal></goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>com.github.jsimone</groupId>
<artifactId>webapp-runner</artifactId>
<version>8.0.30.2</version>
<destFileName>webapp-runner.jar</destFileName>
</artifactItem>
</artifactItems>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<inherited>true</inherited>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<configuration>
<jdkVersion>1.8</jdkVersion>
<appName>immense-beach-86309t</appName>
</configuration>
<groupId>com.heroku.sdk</groupId>
<artifactId>heroku-maven-plugin</artifactId>
<version>1.1.1</version>
</plugin>
</plugins>
</build>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet-core</artifactId>
<!-- use the following artifactId if you don't need servlet 2.x compatibility -->
<!-- artifactId>jersey-container-servlet</artifactId -->
</dependency>
<!-- uncomment this to get JSON support
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
</dependency>
-->
</dependencies>
<properties>
<jersey.version>2.23.2</jersey.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Below is the Procfile
web: java $JAVA_OPTS -jar target/dependency/webapp-runner.jar --port $PORT target/*.war
I suspect that your app name is supposed to be "immense-beach-86309" but you have "immense-beach-86309t" (note the trailing "t") in your pom.xml entry for <appName>.
The error message should be better, and I've opened an issue on the heroku-maven-plugin project, which is open source.

Maven Plugin/Profile Issue

I am an automation qa engineer and I've been charged with setting up our Jenkins CI framework. The issue that I am having is that Maven is failing in the build phase. In looking at the log there a few things that are concerning to me but I am not sure if they are related or relevant. See the log below
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\dmohamed>mvn test -PCustomerFSNRegressionSuite
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for
Envi_Test:Maven:jar:0.0.1-SNAPSHOT
[WARNING] 'dependencies.dependency.systemPath' for com.qas.qtest.api:qtest-sdk-a
gent:jar should not point at files within the project directory, ${basedir}\src\
Libs\qtest-sdk-java-1.1.0.jar will be unresolvable by dependent projects # line
42, column 17
[WARNING] 'dependencies.dependency.systemPath' for com.qas.qtest.api:qtest-testn
g-agent:jar should not point at files within the project directory, ${basedir}\s
rc\Libs\qtest-testng-agent-1.0.0.jar will be unresolvable by dependent projects
# line 50, column 17
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten t
he stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support buildin
g such malformed projects.
[WARNING]
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # Maven ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\dmohamed\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # Maven ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # Ma
ven ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\dmohamed\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # Maven -
--
[INFO] No sources to compile
[INFO]
[INFO] --- maven-surefire-plugin:2.19.1:test (default-test) # Maven ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.190 s
[INFO] Finished at: 2016-08-02T08:25:01-04:00
[INFO] Final Memory: 11M/307M
[INFO] ------------------------------------------------------------------------
[WARNING] The requested profile "CustomerFSNRegressionSuite" could not be activa
ted because it does not exist.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.
19.1:test (default-test) on project Maven: Unable to parse configuration of mojo
org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test for parameter proper
ties: Missing name in properties -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginConfigur
ationException
C:\Users\dmohamed>
my concerns are specifically these lines
INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\dmohamed\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # Maven ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) # Ma
ven ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory
C:\Users\dmohamed\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) # Maven -
--
[INFO] No sources to compile
WARNING] The requested profile "CustomerFSNRegressionSuite" could not be activa
ted because it does not exist.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.
19.1:test (default-test) on project Maven: Unable to parse configuration of mojo
org.apache.maven.plugins:maven-surefire-plugin:2.19.1:test for parameter proper
ties: Missing name in properties -> [Help 1]
It seems as though when I attempt to run the mvn commands it tries to reference srs folders that don't exist (not sure if this does any harm) it doesn't recognize my TestnNG profile specified in my POM file (I am assuming this will impact Jenkins) and there is some property/configuration error in my pom file (Per the ERROR message in my log) that I cannot resolve. See my POM file below
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>Envi_Test</groupId>
<artifactId>Maven</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>Maven</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<profiles>
<profile>
<id>CustomerFSNRegressionSuite</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.19.1</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
<dependencies>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-chrome-driver -->
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.53.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-chrome-driver</artifactId>
<version>2.53.0</version>
</dependency>
<dependency>
<groupId>info.cukes</groupId>
<artifactId>cucumber-testng</artifactId>
<version>1.1.5</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
Any help would be greatly appreciated, I am sorry if this is a repost, I looked but I did not see a question regarding a circumstance like this.

Categories