Error while running building maven project - plugins, API incompatibility - java

I am facing problem while trying to run maven build with JDK6. I am running build inside docker container with JDK6 and Maven.
Do I get it right, that the plugins are not compatibile with JDK6 version and I should use lower version of help plugin? I cannot change JDK version to higher, I ran into this problem while trying to enable bulding project with JDK6, so I want to solve this problem.
error message from Maven:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate (default-cli) on project security-component: Execution default-cli of goal org.apache.maven.plugins:maven-help-plugin:3.2.0:evaluate failed: Unable to load the mojo 'evaluate' in the plugin 'org.apache.maven.plugins:maven-help-plugin:3.2.0' due to an API incompatibility: org.codehaus.plexus.component.repository.exception.ComponentLookupException: org/apache/maven/plugins/help/EvaluateMojo : Unsupported major.minor version 51.0
[ERROR] -----------------------------------------------------
[ERROR] realm = plugin>org.apache.maven.plugins:maven-help-plugin:3.2.0
mvn -version output:
Maven home: /usr/share/maven
Java version: 1.6.0_41, vendor: Sun Microsystems Inc.
Java home: /usr/lib/jvm/java-6-openjdk-amd64/jre

indeed problem was in too high version of help plugin, I lower it to 2.2 and its fine
adding direct path to selected version of help plugin worked for me:
$MVN_CMD org.apache.maven.plugins:maven-help-plugin:2.2:evaluate

Related

Issue with deploying Java 11 app to Heroku from GitLab [duplicate]

This is my code in github:
https://github.com/q463746583/CS4500-Assignment2
I can run it successfully in the local,
but while I try to deploy the code on heroku,
There is the error description:
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/com/thoughtworks/qdox/qdox/2.0-M9/qdox-2.0-M9.jar (317 kB at 6.0 MB/s)
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to /tmp/build_3c4f3b86a26f6e3ae1cbe89639f79f26/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.261 s
[INFO] Finished at: 2019-01-24T00:47:07Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project myapp: Fatal error compiling: invalid target release: 11 -> [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: Failed to build app with Maven
We're sorry this build is failing! If you can't find the issue in application code,
please submit a ticket so we can help: https://help.heroku.com/
! Push rejected, failed to compile Java app.
! Push failed
TLDR:
Ensure you're using the appropriate JAVA JDK
Check that your target environment from the Maven compiler is the same as your targeted Heroku JAVA runtime.
If you're not using the default JAVA 8 JDK runtime environment create a system.properties file in your project specifying a different supported JAVA runtime enviroment as listed within Heroku's JAVA buildpack documentation.
I think this has to do with a mismatch between your targeted Java runtime environment on Heroku and your locally compiled code, generated from the Maven compiler, which you're trying to push to Heroku.
According to Heroku's documentation:
Heroku currently uses OpenJDK 8 to run your application by default. OpenJDK versions 9 and 7 are also available.
Other supported default versions are:
Java 7 - 1.7.0_181
Java 8 - 1.8.0_191
Java 9 - 9.0.4
Java 10 - 10.0.2
Java 11 - 11
So you should make sure that within your pom.xml file that your maven compiler is compiling your JAVA code to the appropriate JAVA buildpack you're targeting on Heroku. For example, below we are targeting a Java 7 runtime environment:
pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
Then you should create a system.properties file in your project if you're targeting a runtime environment other than Heroku's default JDK 1.8 runtime environment. You can do this by specifying your desired java runtime environment like such:
system.properties:
java.runtime.version=11
As per the previous answers, creating a system.properties file, making a new commit with that change and rerunning the heroku command fixed the issue for me.
Also, please be mindful about the name of your branch if you're not using main as your main branch as that would require a match such as.
git push heroku master:main
or
git push heroku develop:main
I got the same error while deploying the git project in Heroku. I just changed java.version to 8 from 11 in pom.xml and it worked for me:
<properties>
<java.version>8</java.version>
</properties>
To remove this error, simply add one extra file into your repository with the name system.application and
java.runtime.version=11
Tried all the approaches, but none worked.
SOLUTION: Remove all the references to your Java version in your pom.xml, i.e.
<properties>
<java.version>11</java.version>
</properties>

Failed to build app with Maven, I can run code locally, but fail to deploy on heroku

This is my code in github:
https://github.com/q463746583/CS4500-Assignment2
I can run it successfully in the local,
but while I try to deploy the code on heroku,
There is the error description:
[INFO] Downloaded from central: https://repo.maven.apache.org/maven2/com/thoughtworks/qdox/qdox/2.0-M9/qdox-2.0-M9.jar (317 kB at 6.0 MB/s)
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 4 source files to /tmp/build_3c4f3b86a26f6e3ae1cbe89639f79f26/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 13.261 s
[INFO] Finished at: 2019-01-24T00:47:07Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project myapp: Fatal error compiling: invalid target release: 11 -> [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: Failed to build app with Maven
We're sorry this build is failing! If you can't find the issue in application code,
please submit a ticket so we can help: https://help.heroku.com/
! Push rejected, failed to compile Java app.
! Push failed
TLDR:
Ensure you're using the appropriate JAVA JDK
Check that your target environment from the Maven compiler is the same as your targeted Heroku JAVA runtime.
If you're not using the default JAVA 8 JDK runtime environment create a system.properties file in your project specifying a different supported JAVA runtime enviroment as listed within Heroku's JAVA buildpack documentation.
I think this has to do with a mismatch between your targeted Java runtime environment on Heroku and your locally compiled code, generated from the Maven compiler, which you're trying to push to Heroku.
According to Heroku's documentation:
Heroku currently uses OpenJDK 8 to run your application by default. OpenJDK versions 9 and 7 are also available.
Other supported default versions are:
Java 7 - 1.7.0_181
Java 8 - 1.8.0_191
Java 9 - 9.0.4
Java 10 - 10.0.2
Java 11 - 11
So you should make sure that within your pom.xml file that your maven compiler is compiling your JAVA code to the appropriate JAVA buildpack you're targeting on Heroku. For example, below we are targeting a Java 7 runtime environment:
pom.xml:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
Then you should create a system.properties file in your project if you're targeting a runtime environment other than Heroku's default JDK 1.8 runtime environment. You can do this by specifying your desired java runtime environment like such:
system.properties:
java.runtime.version=11
As per the previous answers, creating a system.properties file, making a new commit with that change and rerunning the heroku command fixed the issue for me.
Also, please be mindful about the name of your branch if you're not using main as your main branch as that would require a match such as.
git push heroku master:main
or
git push heroku develop:main
I got the same error while deploying the git project in Heroku. I just changed java.version to 8 from 11 in pom.xml and it worked for me:
<properties>
<java.version>8</java.version>
</properties>
To remove this error, simply add one extra file into your repository with the name system.application and
java.runtime.version=11
Tried all the approaches, but none worked.
SOLUTION: Remove all the references to your Java version in your pom.xml, i.e.
<properties>
<java.version>11</java.version>
</properties>

I'm trying to install Apache Gobblin. How can I install it using Gradle?

I want to install Apache Gobblin on my MacOS X. For this, I downloaded version 0.14.0 and followed the steps here.
Install Gobblin
The first thing I did was this:
tar -xvf incubator-gobblin-release-0.14.0.tar.gz
and then:
cd Users/xxxx/incubator-gobblin-release-0.14.0
and finally:
./gradlew build
I came across a error like this.
Parallel execution is an incubating feature.
Parallel execution with configuration on demand is an incubating feature.
> Configure project :
Build property: gobblinFlavor=standard
Build property: jdkVersion=1.8
Build property:
sonatypeArtifactRepository=https://oss.sonatype.org/service/local/staging/deploy/maven2/
Build property:
sonatypeArtifactSnapshotRepository=https://oss.sonatype.org/content/repositories/snapshots/
Build property:
nexusArtifactRepository=https://repository.apache.org/service/local/staging/deploy/maven2
Build property:
nexusArtifactSnapshotRepository=https://repository.apache.org/content/repositories/snapshots
Build property: doNotSignArtifacts=false
Build property: avroVersion=1.8.1
Build property: awsVersion=1.11.8
Build property: bytemanVersion=2.2.1
Build property: confluentVersion=2.0.1
Build property: hadoopVersion=2.3.0
Build property: hiveVersion=1.0.1
Build property: kafka08Version=0.8.2.2
Build property: kafka09Version=0.9.0.1
Build property: pegasusVersion=11.0.0
Build property: salesforceVersion=42.0.0
Detected Gradle version major=4 minor=9
FAILURE: Build failed with an exception.
* Where:
Script '/Users/xxxxxx/incubator-gobblin-release-
0.14.0/gradle/scripts/globalDependencies.gradle' line: 44
* What went wrong:
A problem occurred evaluating script.
> Cannot invoke method getURLs() on null object
* Try:
Run with --stacktrace option to get the stack trace. Run with --info
or --debug option to get more log output. Run with --scan to get full
insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it
incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.9/userguide/command_line_interface.html#sec:command_line_warnings
My Java Version:
java 9.0.4
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
My Maven Version:
Apache Maven 3.5.3 (3383c37e1f9e9b3bc3df5050c29c8aff9f295297; 2018-02-24T22:49:05+03:00)
Maven home: /usr/local/Cellar/maven/3.5.3/libexec
Java version: 9.0.4, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk-9.0.4.jdk/Contents/Home
Default locale: en_TR, platform encoding: UTF-8
OS name: "mac os x", version: "10.14.1", arch: "x86_64", family: "mac"
If anyone has any information or suggestions, I'm waiting.
Just digged a little into the codes. Are you sure that Java 9 is supported by their build scripts?
Look at the line you have issue with: globalDependencies.gradle:44. See ToolProvider.getSystemToolClassLoader(). Now let's look at its docs for Java 9:
Deprecated. This method is subject to removal in a future version of Java SE. Use the system tool provider or service loader mechanisms to locate system tools as well as user-installed tools.
Returns a class loader that may be used to load system tools, or null if no such special loader is provided.
Implementation Requirements:
This implementation always returns null.
See that? It always returns null!
Things were different in Java 8, though:
Returns the class loader for tools provided with this platform. This does not include user-installed tools. Use the service provider mechanism for locating user installed tools.
So the script is calling getURLs on a null object and obviously throws an NPE. It probably needs to be fixed!

EvoSuite java support for Java 7?

Which versions of Java are supported by EvoSuite?
I am running a maven build, following the instructions on the EvoSuite maven plugin page.
However, the build fails with the following message:
Failed to execute goal org.evosuite.plugins:evosuite-maven-
plugin:0.1.1:generate (default-cli) on project simple: Execution default-cli of
goal org.evosuite.plugins:evosuite-maven-plugin:0.1.1:generate failed: Unable
to load the mojo 'generate' in the plugin 'org.evosuite.plugins:evosuite-maven-
plugin:0.1.1' due to an API incompatibility:
org.codehaus.plexus.component.repository.exception.ComponentLookupException:
org/evosuite/maven/GenerateMojo : Unsupported major.minor version 51.0
EvoSuite does support Java 7. The error message that you get seems like the Maven process you used is not using Java 7. You need to be sure that "mvn" is using the right Java version. Use mvn -version to check which one you are using.
See related post: java.lang.UnsupportedClassVersionError: Unsupported major.minor version 51.0 (unable to load class frontend.listener.StartupListener)
NO,at least JAVA8.You can go to the website of Evosuite to learn more.

Building Apache Roller on Windows 7

I am getting this kind of error when i tried to build apache roller on my windows 7 service pack 1 64 bit.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (gen-db-scripts) on project roller-webapp: An Ant BuildException has occured: Exception thrown by 'generator.parse'. For more information consult the velocity log, or invoke ant with the -debug flag.
[ERROR] around Ant part ...<texen outputFile="README.txt" controlTemplate="control.vm" outputDirectory="F:\roller-trunk\app/target/dbscripts" templatePath="F:\roller-trunk\app/src/main/resources/sql" contextProperties="F:\roller-trunk\app/src/main/resources/sql/dbscripts.properties"/>... # 5:261 in F:\roller-trunk\app\target\antrun\build-main.xml: F:\roller-trunk\app\target\dbscripts\db2\createdb.sql (The system cannot find the path specified)
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (gen-db-scripts) on project roller-webapp: An Ant BuildException has occured: Exception thrown by 'generator.parse'. For more information consult the velocity log, or invoke ant with the -debug flag.
around Ant part ...<texen outputFile="README.txt" controlTemplate="control.vm" outputDirectory="F:\roller-trunk\app/target/dbscripts" templatePath="F:\roller-trunk\app/src/main/resources/sql" contextProperties="F:\roller-trunk\app/src/main/resources/sql/dbscripts.properties"/>... # 5:261 in F:\roller-trunk\app\target\antrun\build-main.xml
i suspect this outputDirectory="F:\roller-trunk\app/target/dbscripts" templatePath="F:\roller-trunk\app/src/main/resources/sql"` is the problem but i have no idea how to fix it. I ran the "mvn clean install" from my command prompt.
I succeeded building Roller source code in current SVN trunk (5.2.0-SNAPSHOT) on Windows 7 box without errors. output of mvn -version is following:
Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T20:57:37+09:00)
Maven home: c:\apache-maven-3.3.3
Java version: 1.8.0_45, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.8.0_45\jre
Default locale: ja_JP, platform encoding: MS932
OS name: "windows 7", version: "6.1", arch: "x86", family: "dos"
Could you try building with same version of JDK/Maven to the above output?
UPDATE
Now GitHub distribution of Roller can be built without this error. For detail check https://issues.apache.org/jira/browse/ROL-2086
GitHub doesn't store the empty directories that Roller needs to do the build, if this patch were applied (https://github.com/apache/roller/pull/3) the problem would be fixed.
My work-in-progress Github fork of Roller, TightBlog, already has this change in place: https://github.com/gmazza/tightblog. But TightBlog is not ready for regular use.
I believe this error happens because of direct pull from the Github version. At first, I've tried to pull it from Github and I faced the same problem. Later on, I've tried to checkout it directly from the SVN trunk and there's no problem with the building process.
I believe this error has also been described previously at http://comments.gmane.org/gmane.comp.java.roller.devel/5895. It is stated that there might be some problems with the Github version.

Categories

Resources