I've created a bare-bone Maven project, completely empty except the pom.xml.
With this pom (note that parent element is commented-out):
<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>springboot-test</groupId>
<artifactId>springboot-test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<!-- <parent> -->
<!-- <groupId>org.springframework.boot</groupId> -->
<!-- <artifactId>spring-boot-starter-parent</artifactId> -->
<!-- <version>1.1.9.RELEASE</version> -->
<!-- </parent> -->
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Sample run:
$ mvn exec:java -Dexec.mainClass=test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building springboot-test 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.3.2:java (default-cli) # springboot-test ---
[WARNING] Warning: killAfter is now deprecated. Do you need it ? Please comment on MEXEC-6.
[WARNING]
java.lang.ClassNotFoundException: test
at java.net.URLClassLoader$1.run(URLClassLoader.java:372)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:281)
at java.lang.Thread.run(Thread.java:745)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.480 s
[INFO] Finished at: 2014-12-05T13:45:34-05:00
[INFO] Final Memory: 8M/176M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.2:java (default-cli) on project springboot-test: An exception occured while executing the Java class. test -> [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
This is expected (there's no clas test in this project).
Using this pom (i.e. just un-commenting parent):
<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>springboot-test</groupId>
<artifactId>springboot-test</artifactId>
<version>1.0.0-SNAPSHOT</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.1.9.RELEASE</version>
</parent>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Sample run:
$ mvn exec:java -Dexec.mainClass=test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building springboot-test 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> exec-maven-plugin:1.2.1:java (default-cli) > validate # springboot-test >>>
[INFO]
[INFO] <<< exec-maven-plugin:1.2.1:java (default-cli) < validate # springboot-test <<<
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) # springboot-test ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.550 s
[INFO] Finished at: 2014-12-05T13:45:27-05:00
[INFO] Final Memory: 12M/178M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on project springboot-test: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java are missing or invalid -> [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/PluginParameterException
Same thing happens with exec-maven-plugin:1.3.2:
$ mvn org.codehaus.mojo:exec-maven-plugin:1.3.2:java -Dexec.mainClass=test
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building springboot-test 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.3.2:java (default-cli) # springboot-test ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.400 s
[INFO] Finished at: 2014-12-05T13:52:46-05:00
[INFO] Final Memory: 6M/157M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.3.2:java (default-cli) on project springboot-test: The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.3.2:java are missing or invalid -> [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/PluginParameterException
Additional information:
$ java -version
java version "1.8.0_11"
Java(TM) SE Runtime Environment (build 1.8.0_11-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.11-b03, mixed mode)
$ mvn -v
Apache Maven 3.2.2 (45f7c06d68e745d05611f7fd14efb6594181933e; 2014-06-17T09:51:42-04:00)
Maven home: C:\dev\bin\apache-maven-3.2.2
Java version: 1.8.0_11, vendor: Oracle Corporation
Java home: C:\progra~1\java\jdk1.8.0_11\jre
Default locale: en_US, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "dos"
Questions:
Why is this failing / how to fix?
Why is this failing when parent is added? How is exec-maven-plugin influenced by this?
(As a side note, I love the fact that Windows 7 belongs to faimly: "dos", I'm waiting for family: "cp/m" to be implemented for Windows 8.1)
Its because Spring-Boot is adding some extra maven configuration to your project.
If you are using eclipse, there's a Tab called: 'Effective POM'.
From this tab you can see that it adds this snippet below:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<configuration>
<mainClass>${start-class}</mainClass>
</configuration>
</plugin>
So when you run it with spring-boot as parent, it looks for the value of ${start-class}, which resolves to empty unless you defined it, that's when you see the error about not having a value for the mainClass parameter.
Add this to your project:
<properties>
<start-class>com.Test</start-class>
</properties>
Then run it: clean compile exec:java
[INFO] --- exec-maven-plugin:1.2.1:java (default-cli) # springboot-test ---
**********test**************
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.388 s
[INFO] Finished at: 2014-12-05T15:25:05-06:00
[INFO] Final Memory: 17M/231M
[INFO] ------------------------------------------------------------------------
You can also provide the value for the start-class property on the command line, this works even if you didn't define it inside your pom file:
mvn exec:java -Dstart-class=com.Test
Related
I've spent hours trying to release a project to github with Maven. This is usually not a problem but for some reason it is for this project and I don't understand why. I'm using Maven 3.8.5 with Java 1.8.0_312 and git 2.36.1. Here's the pom.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>se.company.myproject</groupId>
<artifactId>myproject</artifactId>
<version>4.0.0</version>
<packaging>pom</packaging>
<name>myproject-base</name>
<!-- FIXME change it to the project's website -->
<url>http://www.example.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>1.8</java.version>
<slf4j.version>1.7.36</slf4j.version>
</properties>
<modules>
<module>module1</module>
<module>module2</module>
<module>module3</module>
</modules>
<scm>
<connection>scm:git:ssh://git#github.com/mycompany/myproject.git</connection>
<developerConnection>scm:git:ssh://git#github.com/mycompany/myproject.git</developerConnection>
<url>https://github.com/mycompany/myproject.git</url>
<tag>4.0.0</tag>
</scm>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>${slf4j.version}</version>
</dependency>
<dependency>
<groupId>se.company.myproject</groupId>
<artifactId>some-internal-dependency</artifactId>
<version>5.0.1</version>
</dependency>
<!-- Test dependencies -->
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<version>3.9.1</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<tagNameFormat>#{project.version}</tagNameFormat>
<autoVersionSubmodules>true</autoVersionSubmodules>
</configuration>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>company-releases</id>
<name>Internal Releases</name>
<url>https://company.se/company-maven-releases/</url>
</repository>
<snapshotRepository>
<id>company-snapshots</id>
<name>Internal Snapshots</name>
<url>https://company.se/company-maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<repositories>
<repository>
<id>company-releases</id>
<url>https://company.se/company-maven-releases/</url>
</repository>
</repositories>
</project>
When I run maven release:prepare I get this:
[INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) # myproject-module3 ---
[INFO] [INFO] Building jar: /Users/me/code/module3/target/myproject-module3-4.0.0.jar
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Reactor Summary for myproject-base 4.0.0:
[INFO] [INFO]
[INFO] [INFO] myproject-base ..................................... SUCCESS [ 0.059 s]
[INFO] [INFO] module1............................................. SUCCESS [ 1.097 s]
[INFO] [INFO] module2 ............................................ SUCCESS [ 0.603 s]
[INFO] [INFO] module3 ............................................ SUCCESS [ 0.046 s]
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] BUILD SUCCESS
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [INFO] Total time: 1.878 s
[INFO] [INFO] Finished at: 2022-05-20T14:29:16+02:00
[INFO] [INFO] ------------------------------------------------------------------------
[INFO] [prepare] 11/17 scm-commit-release
[INFO] Checking in modified POMs...
[INFO] Executing: /bin/sh -c cd '/Users/me/code/myproject' && 'git' 'add' '--' 'pom.xml' 'module1/pom.xml' 'module2/pom.xml' 'module3/pom.xml'
[INFO] Working directory: /Users/me/code/myproject
[INFO] Executing: /bin/sh -c cd '/Users/me/code/myproject' && 'git' 'rev-parse' '--show-prefix'
[INFO] Working directory: /Users/me/code/myproject
[INFO] Executing: /bin/sh -c cd '/Users/me/code/myproject' && 'git' 'status' '--porcelain' '.'
[INFO] Working directory: /Users/me/code/myproject
[WARNING] Ignoring unrecognized line: ?? module1/pom.xml.releaseBackup
[WARNING] Ignoring unrecognized line: ?? module2/pom.xml.releaseBackup
[WARNING] Ignoring unrecognized line: ?? pom.xml.releaseBackup
[WARNING] Ignoring unrecognized line: ?? release.properties
[WARNING] Ignoring unrecognized line: ?? module3/pom.xml.releaseBackup
[INFO] Executing: /bin/sh -c cd '/Users/me/code/myproject' && 'git' 'commit' '--verbose' '-F' '/var/folders/xb/pl4xth9n5qbgksbyy2fy5lm80000gn/T/maven-scm-1737591658.commit'
[INFO] Working directory: /Users/me/code/myproject
[INFO] Executing: /bin/sh -c cd '/Users/me/code/myproject' && 'git' 'symbolic-ref' 'HEAD'
[INFO] Working directory: /Users/me/code/myproject
[INFO] Executing: /bin/sh -c cd '/Users/me/code/myproject' && 'git' 'push' 'ssh:********#github.com/company/myproject.git' 'refs/heads/main:refs/heads/main'
[INFO] Working directory: /Users/me/code/myproject
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for myproject-base 3.0.1-SNAPSHOT:
[INFO]
[INFO] myproject-base ........................................ FAILURE [ 8.100 s]
[INFO] module1 ............................................... SKIPPED
[INFO] module2 ............................................... SKIPPED
[INFO] module3 ............................................... SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 8.207 s
[INFO] Finished at: 2022-05-20T14:29:18+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-release-plugin:3.0.0-M5:prepare (default-cli) on project myproject: Unable to commit files
[ERROR] Provider message:
[ERROR] The git-push command failed.
[ERROR] Command output:
[ERROR] To ssh://github.com/company/myproject.git
[ERROR] ! [rejected] main -> main (non-fast-forward)
[ERROR] error: failed to push some refs to 'ssh://github.com/company/myproject.git'
[ERROR] hint: Updates were rejected because the tip of your current branch is behind
[ERROR] hint: its remote counterpart. Integrate the remote changes (e.g.
[ERROR] hint: 'git pull ...') before pushing again.
[ERROR] hint: See the 'Note about fast-forwards' in 'git push --help' for details.
[ERROR]
[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
I can push (and pull) just fine from the command line by using the git command. I've tried different versions of the maven-release-plugin to no avail. I've even deleted the entire GitHub repository and pushed it again from my local machine but still, I get the same error. What could be causing this?
A mvn -X prepare should show you which commit is checked out from your git:ssh://git#github.com/mycompany/myproject.git
Compare it with the latest commit on GitHub to understand the difference.
Trying to use an exec goal to do a git pull before mvn release is possible, but it is better to identify first why there is a remote commit that you do not have locally.
I am new in the world of travis CI and would like to make my first build with it, only that when I go to configure it via the .travis.yml file it raises me the following error
[INFO] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/persistenza/DAOGenericoJson.java: Recompile with -Xlint:unchecked for details.
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/Bot.java:[100,53] package it.unibas.utilita does not exist
[ERROR] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/Bot.java:[122,39] package it.unibas.utilita does not exist
[ERROR] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/Bot.java:[125,39] package it.unibas.utilita does not exist
[INFO] 3 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 12.953 s
[INFO] Finished at: 2018-08-14T11:06:22Z
[INFO] Final Memory: 24M/180M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project app: Compilation failure: Compilation failure:
[ERROR] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/Bot.java:[100,53] package it.unibas.utilita does not exist
[ERROR] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/Bot.java:[122,39] package it.unibas.utilita does not exist
[ERROR] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/Bot.java:[125,39] package it.unibas.utilita does not exist
[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
The command "eval mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V " failed. Retrying, 2 of 3.
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T07:58:13Z)
Maven home: /usr/local/maven-3.5.2
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-101-generic", arch: "amd64", family: "unix"
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building app 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # app ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) # app ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 7 source files to /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/target/classes
[INFO] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/persistenza/DAOGenericoJson.java: /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/persistenza/DAOGenericoJson.java uses unchecked or unsafe operations.
[INFO] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/persistenza/DAOGenericoJson.java: Recompile with -Xlint:unchecked for details.
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/Bot.java:[100,53] package it.unibas.utilita does not exist
[ERROR] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/Bot.java:[122,39] package it.unibas.utilita does not exist
[ERROR] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/Bot.java:[125,39] package it.unibas.utilita does not exist
[INFO] 3 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.937 s
[INFO] Finished at: 2018-08-14T11:06:27Z
[INFO] Final Memory: 19M/195M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project app: Compilation failure: Compilation failure:
[ERROR] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/Bot.java:[100,53] package it.unibas.utilita does not exist
[ERROR] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/Bot.java:[122,39] package it.unibas.utilita does not exist
[ERROR] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/Bot.java:[125,39] package it.unibas.utilita does not exist
[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
The command "eval mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V " failed. Retrying, 3 of 3.
Apache Maven 3.5.2 (138edd61fd100ec658bfa2d307c43b76940a5d7d; 2017-10-18T07:58:13Z)
Maven home: /usr/local/maven-3.5.2
Java version: 1.8.0_151, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-8-oracle/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.4.0-101-generic", arch: "amd64", family: "unix"
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building app 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # app ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:3.5.1:compile (default-compile) # app ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 7 source files to /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/target/classes
[INFO] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/persistenza/DAOGenericoJson.java: /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/persistenza/DAOGenericoJson.java uses unchecked or unsafe operations.
[INFO] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/persistenza/DAOGenericoJson.java: Recompile with -Xlint:unchecked for details.
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/Bot.java:[100,53] package it.unibas.utilita does not exist
[ERROR] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/Bot.java:[122,39] package it.unibas.utilita does not exist
[ERROR] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/Bot.java:[125,39] package it.unibas.utilita does not exist
[INFO] 3 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.895 s
[INFO] Finished at: 2018-08-14T11:06:33Z
[INFO] Final Memory: 18M/198M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project app: Compilation failure: Compilation failure:
[ERROR] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/Bot.java:[100,53] package it.unibas.utilita does not exist
[ERROR] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/Bot.java:[122,39] package it.unibas.utilita does not exist
[ERROR] /home/travis/build/vincenzopalazzo/ilveroprogrammatorebotjava/app/src/main/java/top/gigabox/ilveroprogrammatore/Bot.java:[125,39] package it.unibas.utilita does not exist
[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
The command "eval mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V " failed 3 times.
The command "mvn install -DskipTests=true -Dmaven.javadoc.skip=true -B -V" failed and exited with 1 during .
Your build has been stopped.
my .travis.yml file is the following:
language: java
jdk:
- oraclejdk7
- oraclejdk8
- oraclejdk9
before_install:
- cd app
script: mvn clean verify
sudo: disable
my construction tool is maven whose verson is the following:
Apache Maven 3.3.9
Maven home: /usr/share/maven
Java version: 1.8.0_171, vendor: Oracle Corporation
Java home: /usr/local/java/jdk1.8.0_171/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.10.0-38-generic", arch: "amd64", family: "unix"
my pom.xml file is the following:
<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>top.gigabox</groupId>
<artifactId>app</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<name>app</name>
<url>http://maven.apache.org</url>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.telegram</groupId>
<artifactId>telegrambots</artifactId>
<version>4.0.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jdk14</artifactId>
<version>1.7.25</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.google.code.gson/gson -->
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.5</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>top.gigabox.ilveroprogrammatore.Bot</mainClass>
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<id>make-assembly</id> <!-- this is used for inheritance merges -->
<phase>package</phase> <!-- bind to the packaging phase -->
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
the project on which I want to work travis is the following:project
There is a missing dependency in your pom that contains the it.unibas.utilita.Console class.
This one probably as your previous question suggest:
<dependency>
<groupId>unibas</groupId>
<artifactId>utilita</artifactId>
<version>0.1</version>
<scope>system</scope>
<systemPath>/home/vincenzo/MEGA/Programmazione/myLib/java/utilita.jar</systemPath>
</dependency>
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 ?
I normally build/generate the java classes file within the eclipse. However, now I need to have the project working on a machine without eclipse, so I build it directly from command line using maven. Then I got the following errors, did I miss anything here? Thanks!
Edamame$ mvn java:compile
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml
Downloading: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-metadata.xml (13 KB at 23.9 KB/sec)
Downloaded: https://repo.maven.apache.org/maven2/org/codehaus/mojo/maven-metadata.xml (20 KB at 36.1 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.023 s
[INFO] Finished at: 2015-07-09T07:23:05-07:00
[INFO] Final Memory: 9M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] No plugin found for prefix 'java' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (/Users/Edamame/.m2/repository), central (https://repo.maven.apache.org/maven2)] -> [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/NoPluginFoundForPrefixException
And here is the 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>
<groupId>edamame.hadoop</groupId>
<artifactId>myProject</artifactId>
<version>1.1</version>
<packaging>pom</packaging>
<name>EdamameProject</name>
<url>http://myEdamame.com</url>
<properties>
<jdkLevel>1.7</jdkLevel>
<requiredMavenVersion>[2.1,)</requiredMavenVersion>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.outputEncoding>UTF-8</project.build.outputEncoding>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.1</version>
<configuration>
<source>${jdkLevel}</source>
<target>${jdkLevel}</target>
<showDeprecation>true</showDeprecation>
<showWarnings>true</showWarnings>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
:
</repositories>
<dependencies>
:
</dependencies>
</project>
Also, here is the output of "mvn compile", it succeeded, just doesn't create target/classes folder and its classes.
Edamame$ mvn compile
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building myProject 1.1
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.073 s
[INFO] Finished at: 2015-07-09T08:26:12-07:00
[INFO] Final Memory: 6M/245M
[INFO] ------------------------------------------------------------------------
First you need to change the <packaging> value in your pom.xml to something other than "pom" to make Maven run the compile plugin at all. Try "jar".
Then, if you just want to compile the sources, use
mvn compile
If you want a packaged JAR, call
mvn package
See Maven Build Lifecycle and Maven POM Reference for details.
You should just go: mvn compile (or even mvn install or something like that to test it and make everything).
I am trying to execute below sparkSQL example,
https://github.com/apache/spark/blob/master/examples/src/main/java/org/apache/spark/examples/sql/JavaSparkSQL.java
my pom.xml (i have added sql dependency as well, i am stuck please help)
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>edu.berkeley</groupId>
<artifactId>simple-project</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<name>Simple Project</name>
<repositories>
<repository>
<id>Akka repository</id>
<url>http://repo.akka.io/releases</url>
</repository>
</repositories>
<dependencies>
<dependency> <!-- Spark dependency -->
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>1.0.2</version>
</dependency>
<dependency> <!-- Spark dependency -->
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.10</artifactId>
<version>1.0.2</version>
</dependency>
</dependencies>
</project>
i have just renamed the file as SimpleApp.java
I get this following error when compiling.. kindly advice
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Simple Project 1.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) # simple-project ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /Volumes/Official/spark-1.0.2-bin-hadoop2/try/simple-project/src/main/resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) # simple-project ---
[WARNING] File encoding has not been set, using platform encoding UTF-8, i.e. build is platform dependent!
[INFO] Compiling 1 source file to /Volumes/Official/spark-1.0.2-bin-hadoop2/try/simple-project/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /Volumes/Official/spark-1.0.2-bin-hadoop2/try/simple-project/src/main/java/SimpleApp.java:[61,16] error: cannot find symbol
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.801 s
[INFO] Finished at: 2014-08-19T10:30:31+05:30
[INFO] Final Memory: 21M/232M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project simple-project: Compilation failure
[ERROR] /Volumes/Official/spark-1.0.2-bin-hadoop2/try/simple-project/src/main/java/SimpleApp.java:[61,16] error: cannot find symbol
[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
I found out the issue:
In the example
https://github.com/apache/spark/blob/master/examples/src/main/java/org/apache/spark/examples/sql/JavaSparkSQL.java
replace the line schemaPeople.registerTempTable("people");
with schemaPeople.registerAsTable("people");
compile and package with mvn compile and mvn package and run with
bin/spark-submit --class "org.apache.spark.examples.sql.SimpleApp" --master local[4] try/simple-project/target/simple-project-1.0.jar