maven-surefire-plugin:2.18.1:test failed - java

I'm studying "Cloud-Native Applications in Java" and I'm doing the exercise in this book. This is my pom.xml:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.3.RELEASE</version>
</parent>
<groupId>com.mycompany.petstore</groupId>
<artifactId>product</artifactId>
<version>0.0.1-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
I set up the settings of Maven on a specific path: C:\Users\Sam.m2\settings.xml
The only information that I set up on my settings.xml is the following:
...
<proxies>
<proxy>
<id>myproxy</id>
<active>true</active>
<protocol>http</protocol>
<host>localhost:8080</host>
<nonProxyHosts>localhost,127.0.0.1</nonProxyHosts>
<port>8080</port>
</proxy>
</proxies>
When I try to run this program (a simple program with three java classes), in my console there is:
--- maven-surefire-plugin:2.18.1:test (default-test) # product ---
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/maven-surefire-common/2.18.1/maven-surefire-common-2.18.1.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-api/2.18.1/surefire-api-2.18.1.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/maven-toolchain/2.2.1/maven-toolchain-2.2.1.pom
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugin-tools/maven-plugin-annotations/3.3/maven-plugin-annotations-3.3.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.873 s
[INFO] Finished at: 2019-07-21T15:32:13+02:00
[INFO] Final Memory: 18M/224M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project product: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test failed: Plugin org.apache.maven.plugins:maven-surefire-plugin:2.18.1 or one of its dependencies could not be resolved: Failed to collect dependencies at org.apache.maven.plugins:maven-surefire-plugin:jar:2.18.1 -> org.apache.maven.surefire:maven-surefire-common:jar:2.18.1: Failed to read artifact descriptor for org.apache.maven.surefire:maven-surefire-common:jar:2.18.1: Could not transfer artifact org.apache.maven.surefire:maven-surefire-common:pom:2.18.1 from/to central (https://repo.maven.apache.org/maven2): localhost:8080 -> [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
How can I solve the problem?

Related

Maven custom archetype failing to generate project

I am trying to create new maven archetype to generate custom project as per my needs. My project looks like below
My archetype pom looks like following:
<?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.tarkshala</groupId>
<artifactId>maven-archetype-tarkshala-service-models</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>tarkshala-service-models-archetype</name>
<!-- Used to point local artifacts to the hosted repo , Starts -->
<distributionManagement>
<repository>
<id>nexus</id>
<name>maven-releases</name>
<url>http://maven.tarkshala.com:10081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>nexus</id>
<name>maven-snapshots</name>
<url>http://maven.tarkshala.com:10081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<!-- Ends -->
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>18</source>
<target>18</target>
<compilerArgs>--enable-preview</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
<!-- Check we can delete compiler properties-->
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>
</project>
and my archetype.xml looks like following
<archetype-descriptor xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd"
name="maven-archetype-sample" partial="false">
<requiredProperties>
<!-- This is used in pom.xml of the future app. -->
<requiredProperty key="projectName">
<defaultValue>TarkshalaService</defaultValue>
</requiredProperty>
</requiredProperties>
<fileSets>
<fileSet filtered="true" packaged="true">
<directory>src/main/java</directory>
<includes>
<include>**/**.java</include>
</includes>
</fileSet>
<fileSet filtered="true">
<directory/>
<includes>
<include>*.yml</include>
<include>.gitignore</include>
<include>*.md</include>
<include>*.xml</include>
</includes>
</fileSet>
</fileSets>
</archetype-descriptor>
mvn clean install is successful when done on archetype, but mvn generate fails as following
~/W/r/maven-archetype-tarkshala-service-models (master|✚1) [1]$ mvn archetype:generate \
-DarchetypeGroupId=com.tarkshala \
-DarchetypeArtifactId=maven-archetype-tarkshala-service-models \
-DarchetypeVersion=1.0-SNAPSHOT \
-DgroupId=com.tarkshala \
-DartifactId=dhaba-models \
-DprojectName=DhabaModels
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.tarkshala:maven-archetype-tarkshala-service-models:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. # line 31, column 21
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING]
[INFO]
[INFO] -------< com.tarkshala:maven-archetype-tarkshala-service-models >-------
[INFO] Building tarkshala-service-models-archetype 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> maven-archetype-plugin:3.2.1:generate (default-cli) > generate-sources # maven-archetype-tarkshala-service-models >>>
[INFO]
[INFO] <<< maven-archetype-plugin:3.2.1:generate (default-cli) < generate-sources # maven-archetype-tarkshala-service-models <<<
[INFO]
[INFO]
[INFO] --- maven-archetype-plugin:3.2.1:generate (default-cli) # maven-archetype-tarkshala-service-models ---
[INFO] Generating project in Interactive mode
[WARNING] Archetype not found in any catalog. Falling back to central repository.
[WARNING] Add a repository with id 'archetype' in your settings.xml if archetype's repository is elsewhere.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 4.892 s
[INFO] Finished at: 2023-01-28T07:38:18+05:30
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate (default-cli) on project maven-archetype-tarkshala-service-models: Cannot invoke "org.codehaus.plexus.util.xml.Xpp3Dom.getValue()" because the return value of "org.codehaus.plexus.util.xml.Xpp3Dom.getChild(String)" is null -> [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
Can someone please help to point what exactly am I doing wrong.

maven - skip dependency during build

I want to skip demo-api (Which is another module) during build. Setting optional true doesn't work. Any suggestions on how to skip it but not delete the dependency from pom.xml?
Failed to execute goal on project [36mdemo-web[m: [1;31mCould not resolve dependencies for project demo-web:demo-web:war:1.0-SNAPSHOT: Failed to collect dependencies at demo-api:demo-api:jar:1.0-SNAPSHOT[m: Failed to read artifact descriptor for demo-api:demo-api:jar:1.0-SNAPSHOT: Could not find artifact demo-spring-boot:demo-spring-boot:pom:1.0-SNAPSHOT
<dependency>
<artifactId>demo-api</artifactId>
<groupId>demo-api</groupId>
<version>1.0-SNAPSHOT</version>
<optional>true</optional>
</dependency>
You can put that dependency in a profile:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.foo</groupId>
<artifactId>foo</artifactId>
<version>1.0.0-SNAPSHOT</version>
<organization>
<name>Example Company</name>
<url>http://www.example.com/</url>
</organization>
<name>foo</name>
<profiles>
<profile>
<id>includeBadDependency</id>
<dependencies>
<dependency>
<artifactId>demo-api</artifactId>
<groupId>demo-api</groupId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
</profile>
</profiles>
<!-- Normal dependencies go here-->
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>4.2.5.RELEASE</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
When you build this project:
$ mvn verify # this will succeed
$ mvn verify -PincludeBadDependency
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------------< org.foo:foo >-----------------------------
[INFO] Building foo 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
Downloading from maven-atlassian-com: https://packages.atlassian.com/maven/repository/internal/demo-api/demo-api/1.0-SNAPSHOT/maven-metadata.xml
Downloading from maven-atlassian-com: https://packages.atlassian.com/maven/repository/internal/demo-api/demo-api/1.0-SNAPSHOT/demo-api-1.0-SNAPSHOT.pom
[WARNING] The POM for demo-api:demo-api:jar:1.0-SNAPSHOT is missing, no dependency information available
Downloading from maven-atlassian-com: https://packages.atlassian.com/maven/repository/internal/demo-api/demo-api/1.0-SNAPSHOT/demo-api-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.434 s
[INFO] Finished at: 2021-09-21T18:24:24+10:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project foo: Could not resolve dependencies for project org.foo:foo:jar:1.0.0-SNAPSHOT: Could not find artifact demo-api:demo-api:jar:1.0-SNAPSHOT in maven-atlassian-com (https://packages.atlassian.com/maven/repository/internal) -> [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/DependencyResolutionException
https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html
Maybe this can give you a hint or two.
<scope>runtime</scope>
I think this will do the trick

Building an executable JavaFX app with java SDK 11.0.6

I have a JavaFX app that I have successfully built and run with Java SDK 1.8. I am trying to move it to Java 11 with an ultimate goal of using Java 14 and can not create a runnable jar. To try and understand the process I have downloaded the javafx helloFX example and tried to follow the instructions at https://openjfx.io/openjfx-docs/#modular for Maven. When I run the mvn clean javafx:jlink I get the error:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------< org.openjfx:hellofx >-------------------------
[INFO] Building demo 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) # hellofx ---
[INFO] Deleting C:\Users\jungl\eclipse-workspace\helloFX\Maven\hellofx\target
[INFO]
[INFO] --- javafx-maven-plugin:0.0.3:jlink (default-cli) # hellofx ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\jungl\eclipse-workspace\helloFX\Maven\hellofx\src\main\resources
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to C:\Users\jungl\eclipse-workspace\helloFX\Maven\hellofx\target\classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.345 s
[INFO] Finished at: 2020-04-14T14:52:18+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.openjfx:javafx-maven-plugin:0.0.3:jlink (default-cli) on project hellofx: Error: jlink requires a module descriptor -> [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
The pom.xml is
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.openjfx</groupId>
<artifactId>hellofx</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>demo</name>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>org.openjfx</groupId>
<artifactId>javafx-controls</artifactId>
<version>11</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openjfx</groupId>
<artifactId>javafx-maven-plugin</artifactId>
<version>0.0.3</version>
<configuration>
<mainClass>HelloFX</mainClass>
<jlinkImageName>hello></jlinkImageName>
<jlinkZipName>hellozip></jlinkZipName>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- https://mvnrepository.com/artifact/com.zenjava/javafx-maven-plugin -->
Can anyone point me in the correct direction as I am failing to understand the issue.
The provided example is not structured as the tutorial says. The maven version has been updated under the CommandLine folder. If you go to: ..\CommandLine\Modular\Maven\helloFX and enter the commands mvn clean javafx:run, clean javafx:jlink, target\hellofx\bin\launcher it runs as described in the tutorial.

Maven cannot find dependency in local repository [duplicate]

This question already has answers here:
Maven project cannot locate dependencies in local repository
(4 answers)
Closed 6 years ago.
It seems very simple so I must have some problem with configuration.
There is a demo project with 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.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.1.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>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
This project build and installs correctly in my .m2
Then I have another project, with 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.example</groupId>
<artifactId>demo2</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>demo2</name>
<description>Demo project for Spring Boot</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.1.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>
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
When trying to access a class from demo, I get:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building demo2 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.6.1:clean (default-clean) # demo2 ---
[INFO] Deleting /home/lukasz/parent/demo2/target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # demo2 ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) # demo2 ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /home/lukasz/parent/demo2/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/lukasz/parent/demo2/src/main/java/com/example/Demo2Application.java:[11,17] cannot find symbol
symbol: class Aclass
location: class com.example.Demo2Application
[ERROR] /home/lukasz/parent/demo2/src/main/java/com/example/Demo2Application.java:[11,32] cannot find symbol
symbol: class Aclass
location: class com.example.Demo2Application
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.096 s
[INFO] Finished at: 2017-02-19T01:11:21+01:00
[INFO] Final Memory: 21M/203M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project demo2: Compilation failure: Compilation failure:
[ERROR] /home/lukasz/parent/demo2/src/main/java/com/example/Demo2Application.java:[11,17] cannot find symbol
[ERROR] symbol: class Aclass
[ERROR] location: class com.example.Demo2Application
[ERROR] /home/lukasz/parent/demo2/src/main/java/com/example/Demo2Application.java:[11,32] cannot find symbol
[ERROR] symbol: class Aclass
[ERROR] location: class com.example.Demo2Application
[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?
EDIT:
Obviously, I did mvn clean install on demo project. Funny thing is I can use with:
javac -cp .m2/repository/com/example/demo/0.0.1-SNAPSHOT/demo-0.0.1-SNAPSHOT.jar <any java file here>
EDIT:
Last part of mvn -X:
[DEBUG] Classpath: [/home/ala/parent/demo2/target/classes
/home/ala/.m2/repository/com/example/demo/0.0.1-SNAPSHOT/demo-0.0.1-SNAPSHOT.jar
/home/ala/.m2/repository/org/springframework/boot/spring-boot-starter/1.5.1.RELEASE/spring-boot-starter-1.5.1.RELEASE.jar
/home/ala/.m2/repository/org/springframework/boot/spring-boot/1.5.1.RELEASE/spring-boot-1.5.1.RELEASE.jar
/home/ala/.m2/repository/org/springframework/spring-context/4.3.6.RELEASE/spring-context-4.3.6.RELEASE.jar
/home/ala/.m2/repository/org/springframework/spring-aop/4.3.6.RELEASE/spring-aop-4.3.6.RELEASE.jar
/home/ala/.m2/repository/org/springframework/spring-beans/4.3.6.RELEASE/spring-beans-4.3.6.RELEASE.jar
/home/ala/.m2/repository/org/springframework/spring-expression/4.3.6.RELEASE/spring-expression-4.3.6.RELEASE.jar
/home/ala/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.5.1.RELEASE/spring-boot-autoconfigure-1.5.1.RELEASE.jar
/home/ala/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.5.1.RELEASE/spring-boot-starter-logging-1.5.1.RELEASE.jar
/home/ala/.m2/repository/ch/qos/logback/logback-classic/1.1.9/logback-classic-1.1.9.jar
/home/ala/.m2/repository/ch/qos/logback/logback-core/1.1.9/logback-core-1.1.9.jar
/home/ala/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.22/jcl-over-slf4j-1.7.22.jar
/home/ala/.m2/repository/org/slf4j/jul-to-slf4j/1.7.22/jul-to-slf4j-1.7.22.jar
/home/ala/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.22/log4j-over-slf4j-1.7.22.jar
/home/ala/.m2/repository/org/springframework/spring-core/4.3.6.RELEASE/spring-core-4.3.6.RELEASE.jar
/home/ala/.m2/repository/org/slf4j/slf4j-api/1.7.22/slf4j-api-1.7.22.jar]
[DEBUG] Output directory: /home/ala/parent/demo2/target/classes
[DEBUG] CompilerReuseStrategy: reuseCreated
[DEBUG] useIncrementalCompilation enabled
[DEBUG] Stale source detected: /home/ala/parent/demo2/src/main/java/com/example/Demo2Application.java
[INFO] Changes detected - recompiling the module!
[DEBUG] Classpath:
[DEBUG] /home/ala/parent/demo2/target/classes
[DEBUG] /home/ala/.m2/repository/com/example/demo/0.0.1-SNAPSHOT/demo-0.0.1-SNAPSHOT.jar
[DEBUG] /home/ala/.m2/repository/org/springframework/boot/spring-boot-starter/1.5.1.RELEASE/spring-boot-starter-1.5.1.RELEASE.jar
[DEBUG] /home/ala/.m2/repository/org/springframework/boot/spring-boot/1.5.1.RELEASE/spring-boot-1.5.1.RELEASE.jar
[DEBUG] /home/ala/.m2/repository/org/springframework/spring-context/4.3.6.RELEASE/spring-context-4.3.6.RELEASE.jar
[DEBUG] /home/ala/.m2/repository/org/springframework/spring-aop/4.3.6.RELEASE/spring-aop-4.3.6.RELEASE.jar
[DEBUG] /home/ala/.m2/repository/org/springframework/spring-beans/4.3.6.RELEASE/spring-beans-4.3.6.RELEASE.jar
[DEBUG] /home/ala/.m2/repository/org/springframework/spring-expression/4.3.6.RELEASE/spring-expression-4.3.6.RELEASE.jar
[DEBUG] /home/ala/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.5.1.RELEASE/spring-boot-autoconfigure-1.5.1.RELEASE.jar
[DEBUG] /home/ala/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.5.1.RELEASE/spring-boot-starter-logging-1.5.1.RELEASE.jar
[DEBUG] /home/ala/.m2/repository/ch/qos/logback/logback-classic/1.1.9/logback-classic-1.1.9.jar
[DEBUG] /home/ala/.m2/repository/ch/qos/logback/logback-core/1.1.9/logback-core-1.1.9.jar
[DEBUG] /home/ala/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.22/jcl-over-slf4j-1.7.22.jar
[DEBUG] /home/ala/.m2/repository/org/slf4j/jul-to-slf4j/1.7.22/jul-to-slf4j-1.7.22.jar
[DEBUG] /home/ala/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.22/log4j-over-slf4j-1.7.22.jar
[DEBUG] /home/ala/.m2/repository/org/springframework/spring-core/4.3.6.RELEASE/spring-core-4.3.6.RELEASE.jar
[DEBUG] /home/ala/.m2/repository/org/slf4j/slf4j-api/1.7.22/slf4j-api-1.7.22.jar
[DEBUG] Source roots:
[DEBUG] /home/ala/parent/demo2/src/main/java
[DEBUG] Command line options:
[DEBUG] -d /home/ala/parent/demo2/target/classes -classpath /home/ala/parent/demo2/target/classes:/home/ala/.m2/repository/com/example/demo/0.0.1-SNAPSHOT/demo-0.0.1-SNAPSHOT.jar:/home/ala/.m2/repository/org/springframework/boot/spring-boot-starter/1.5.1.RELEASE/spring-boot-starter-1.5.1.RELEASE.jar:/home/ala/.m2/repository/org/springframework/boot/spring-boot/1.5.1.RELEASE/spring-boot-1.5.1.RELEASE.jar:/home/ala/.m2/repository/org/springframework/spring-context/4.3.6.RELEASE/spring-context-4.3.6.RELEASE.jar:/home/ala/.m2/repository/org/springframework/spring-aop/4.3.6.RELEASE/spring-aop-4.3.6.RELEASE.jar:/home/ala/.m2/repository/org/springframework/spring-beans/4.3.6.RELEASE/spring-beans-4.3.6.RELEASE.jar:/home/ala/.m2/repository/org/springframework/spring-expression/4.3.6.RELEASE/spring-expression-4.3.6.RELEASE.jar:/home/ala/.m2/repository/org/springframework/boot/spring-boot-autoconfigure/1.5.1.RELEASE/spring-boot-autoconfigure-1.5.1.RELEASE.jar:/home/ala/.m2/repository/org/springframework/boot/spring-boot-starter-logging/1.5.1.RELEASE/spring-boot-starter-logging-1.5.1.RELEASE.jar:/home/ala/.m2/repository/ch/qos/logback/logback-classic/1.1.9/logback-classic-1.1.9.jar:/home/ala/.m2/repository/ch/qos/logback/logback-core/1.1.9/logback-core-1.1.9.jar:/home/ala/.m2/repository/org/slf4j/jcl-over-slf4j/1.7.22/jcl-over-slf4j-1.7.22.jar:/home/ala/.m2/repository/org/slf4j/jul-to-slf4j/1.7.22/jul-to-slf4j-1.7.22.jar:/home/ala/.m2/repository/org/slf4j/log4j-over-slf4j/1.7.22/log4j-over-slf4j-1.7.22.jar:/home/ala/.m2/repository/org/springframework/spring-core/4.3.6.RELEASE/spring-core-4.3.6.RELEASE.jar:/home/ala/.m2/repository/org/slf4j/slf4j-api/1.7.22/slf4j-api-1.7.22.jar: -sourcepath /home/ala/parent/demo2/src/main/java: -s /home/ala/parent/demo2/target/generated-sources/annotations -g -nowarn -target 1.8 -source 1.8 -encoding UTF-8
[DEBUG] incrementalBuildHelper#beforeRebuildExecution
[INFO] Compiling 1 source file to /home/ala/parent/demo2/target/classes
[DEBUG] incrementalBuildHelper#afterRebuildExecution
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/ala/parent/demo2/src/main/java/com/example/Demo2Application.java:[11,17] cannot find symbol
symbol: class Aclass
location: class com.example.Demo2Application
[ERROR] /home/ala/parent/demo2/src/main/java/com/example/Demo2Application.java:[11,32] cannot find symbol
symbol: class Aclass
location: class com.example.Demo2Application
[INFO] 2 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.789 s
[INFO] Finished at: 2017-02-19T07:15:39+01:00
[INFO] Final Memory: 21M/201M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project demo2: Compilation failure: Compilation failure:
[ERROR] /home/ala/parent/demo2/src/main/java/com/example/Demo2Application.java:[11,17] cannot find symbol
[ERROR] symbol: class Aclass
[ERROR] location: class com.example.Demo2Application
[ERROR] /home/ala/parent/demo2/src/main/java/com/example/Demo2Application.java:[11,32] cannot find symbol
[ERROR] symbol: class Aclass
[ERROR] location: class com.example.Demo2Application
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project demo2: Compilation failure
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.compiler.CompilationFailureException: Compilation failure
at org.apache.maven.plugin.compiler.AbstractCompilerMojo.execute(AbstractCompilerMojo.java:858)
at org.apache.maven.plugin.compiler.CompilerMojo.execute(CompilerMojo.java:129)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
[ERROR]
[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
Here are few suggestions:
Run your broken build with "mvn -X clean install" for debugging. The log should include what repo. URLs Maven is looking for each dependency.
Unzip your jar file to verify classes you want are included or not.
Maven didn't found package com.example in this configuration.
<dependency>
<groupId>com.example</groupId>
<artifactId>demo</artifactId>
<version>0.0.1-SNAPSHOT</version> </dependency>
So you must install this package as local package by use command: mvn clean install in the first project.
Or you can also install it as 3rd party package by using:
mvn install:install-file -Dfile={your directory}\demo-{version}.jar
-DgroupId=com.example
-DartifactId=demo -Dversion={version} -Dpackaging=jar
After install correctly, it will works.

Heroku not resolves local Maven dependencies

I am using custom dependencies in my project, hosted on Heroku, and when I push my changes via Git, the server throws this log (Maven tries to download from public repositories):
... Remote repositories download ...
[INFO] Downloading: https://repo.maven.apache.org/maven2/javax/inject/javax.inject/1/javax.inject-1.jar //Example of correct file
[INFO] Downloading: file:/tmp/build_2b1a7b0432368beb5dc5ba232fac767a/repo/com/example/functions/17.0/functions-17.0.jar
[INFO] Downloading: file:/tmp/build_2b1a7b0432368beb5dc5ba232fac767a/repo/com/example/routines/17.0/routines-17.0.jar
... More downloads ...
[INFO] Downloading: https://repo.maven.apache.org/maven2/com/example/routines/17.0/routines-17.0.jar
[INFO] Downloading: https://repo.maven.apache.org/maven2/com/example/functions/17.0/functions-17.0.jar
... More downloads ...
[INFO] Downloaded: https://repo.maven.apache.org/maven2/javax/inject/javax.inject/1/javax.inject-1.jar (3 KB at 7.6 KB/sec) //Correct file downloaded
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.755 s
[INFO] Finished at: 2015-12-04T09:19:40+00:00
[INFO] Final Memory: 14M/241M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project example-project: Could not resolve dependencies for project example-project:example-project:jar:0.0.1-SNAPSHOT: The following artifacts could not be resolved: com.example:functions:jar:17.0, com.example:routines:jar:17.0: in project.local (file:/tmp/build_2b1a7b0432368beb5dc5ba232fac767a/repo) -> [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/DependencyResolutionException
I followed this guide and I don't use settings.xml file. My pom.xml is this:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>example-project</groupId>
<artifactId>example-project</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>My example project</name>
<description>Example of Maven Project</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<repositories>
<repository>
<id>project.local</id>
<name>project</name>
<url>file:${project.basedir}/repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>functions</artifactId>
<version>17.0</version>
</dependency>
<dependency>
<groupId>com.example</groupId>
<artifactId>routines</artifactId>
<version>17.0</version>
</dependency>
... More dependencies ...
</dependencies>
... Plugins ...
</project>
How can I upload my custom JARs to Heroku?
I solved it adding Maven plugin for Heroku and uploading the project with the Maven command.

Categories

Resources