Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot compile project #3

Closed
aubertc opened this issue Feb 17, 2022 · 5 comments
Closed

Cannot compile project #3

aubertc opened this issue Feb 17, 2022 · 5 comments

Comments

@aubertc
Copy link
Member

aubertc commented Feb 17, 2022

I get an error when trying to compile your project:

mvn compile
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO] 
[INFO] ----------------------------< me.gmx:RCCS >-----------------------------
[INFO] Building RCCS 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ RCCS ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/au/travail/git/RCCS_Impl/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ RCCS ---
[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 6 source files to /home/au/travail/git/RCCS_Impl/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.839 s
[INFO] Finished at: 2022-02-16T22:55:33-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project RCCS: Fatal error compiling: error: invalid target release: 17 -> [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 warnings seem to be customary (cf. google/guice#1133 ), but I'm not sure I can debug the errors. I can give more detailed log if needed.

@aubertc
Copy link
Member Author

aubertc commented Feb 23, 2022

Ok, so now I get

mvn package
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for me.gmx:RCCS:jar:1.0-SNAPSHOT
[WARNING] 'build.plugins.plugin.version' for org.apache.maven.plugins:maven-compiler-plugin is missing. @ line 20, 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] ----------------------------< me.gmx:RCCS >-----------------------------
[INFO] Building RCCS 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ RCCS ---
[WARNING] Using platform encoding (UTF-8 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory /home/au/travail/git/RCCS_Impl/src/main/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ RCCS ---
[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 17 source files to /home/au/travail/git/RCCS_Impl/target/classes
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.947 s
[INFO] Finished at: 2022-02-22T19:58:40-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project RCCS: Fatal error compiling: error: invalid target release: 17 -> [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
 mvn -version
Apache Maven 3.6.0
Maven home: /usr/share/maven
Java version: 11.0.14, vendor: Debian, runtime: /usr/lib/jvm/java-11-openjdk-amd64
Default locale: fr_FR, platform encoding: UTF-8
OS name: "linux", version: "4.19.0-18-amd64", arch: "amd64", family: "unix"
 java -version
openjdk version "11.0.14" 2022-01-18
OpenJDK Runtime Environment (build 11.0.14+9-post-Debian-1deb10u1)
OpenJDK 64-Bit Server VM (build 11.0.14+9-post-Debian-1deb10u1, mixed mode, sharing)

Does updating my java seems the right way to proceed? It is fairly version, but the _open_jdk version, maybe I need Oracle's JDK? I know there are ways to do it ( https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-on-debian-9#installing-the-oracle-jdk ).

@aubertc
Copy link
Member Author

aubertc commented Mar 9, 2022

(I should update the title…).

I can compile:

mvn assembly:single
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.google.inject.internal.cglib.core.$ReflectUtils$1 (file:/usr/share/maven/lib/guice.jar) to method java.lang.ClassLoader.defineClass(java.lang.String,byte[],int,int,java.security.ProtectionDomain)
WARNING: Please consider reporting this to the maintainers of com.google.inject.internal.cglib.core.$ReflectUtils$1
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
[INFO] Scanning for projects...
[INFO] 
[INFO] ----------------------------< me.gmx:RCCS >-----------------------------
[INFO] Building RCCS 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-assembly-plugin:3.3.0:single (default-cli) @ RCCS ---
[WARNING] Cannot include project artifact: me.gmx:RCCS:jar:1.0-SNAPSHOT; it doesn't have an associated file or directory.
[INFO] Building jar: /home/au/travail/git/RCCS_Impl/target/RCCS-1.0-SNAPSHOT-jar-with-dependencies.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.002 s
[INFO] Finished at: 2022-03-08T21:52:55-05:00
[INFO] ---------------------------------------------------

but I don't think I can execute:

ls target/
archive-tmp  classes  generated-sources  maven-status  RCCS-1.0-SNAPSHOT-jar-with-dependencies.jar
java -jar target/RCCS-1.0-SNAPSHOT-jar-with-dependencies.jar  "a.b.P|c.a.Q + d.e.F"
Error: Could not find or load main class me.gmx.RCCS
Caused by: java.lang.ClassNotFoundException: me.gmx.RCCS

What am I missing?

@aubertc
Copy link
Member Author

aubertc commented Mar 9, 2022

I think I have updated everything as I should, but I am still facing issues

 /opt/maven/bin/mvn -v
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: /opt/maven
Java version: 17.0.2, vendor: Oracle Corporation, runtime: /opt/jdk17.0.2
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.19.0-18-amd64", arch: "amd64", family: "unix"

and

java -version
java version "17.0.2" 2022-01-18 LTS
Java(TM) SE Runtime Environment (build 17.0.2+8-LTS-86)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.2+8-LTS-86, mixed mode, sharing)

but, /opt/maven/bin/mvn package gives:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project RCCS: Compilation failure
[ERROR] /home/caubert/travail/git/RCCS_Impl/src/main/java/me/gmx/parser/StringWalker.java:[189,28] cannot infer type arguments for java.util.Iterator<E>
[ERROR]   reason: '<>' with anonymous inner classes is not supported in -source 8
[ERROR]     (use -source 9 or higher to enable '<>' with anonymous inner classes)
[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

Any idea, @peterbro1 ?

@peterbro1
Copy link
Collaborator

I think I have updated everything as I should, but I am still facing issues

 /opt/maven/bin/mvn -v
Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537)
Maven home: /opt/maven
Java version: 17.0.2, vendor: Oracle Corporation, runtime: /opt/jdk17.0.2
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.19.0-18-amd64", arch: "amd64", family: "unix"

and

java -version
java version "17.0.2" 2022-01-18 LTS
Java(TM) SE Runtime Environment (build 17.0.2+8-LTS-86)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.2+8-LTS-86, mixed mode, sharing)

but, /opt/maven/bin/mvn package gives:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.1:compile (default-compile) on project RCCS: Compilation failure
[ERROR] /home/caubert/travail/git/RCCS_Impl/src/main/java/me/gmx/parser/StringWalker.java:[189,28] cannot infer type arguments for java.util.Iterator<E>
[ERROR]   reason: '<>' with anonymous inner classes is not supported in -source 8
[ERROR]     (use -source 9 or higher to enable '<>' with anonymous inner classes)
[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

Any idea, @peterbro1 ?

My most recent commit will fix that. The java version target was set lower, it should be good now.

@aubertc
Copy link
Member Author

aubertc commented Mar 9, 2022

Thanks, it is fixed now.

@aubertc aubertc closed this as completed Mar 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants