2

I have a project in java spring with intellij idea,

when I have import maven dependencies gave me this error:

Cannot resolve plugin org.apache.maven.plugins:maven-site-plugin:3.6

although this plugin exist in .m2 folder

when I have build project by bash out of itellij gave me:

$ mvn clean package && mvn spring-boot:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------< com.loya:spring-jpa-oracle-demo >-------------------
[INFO] Building spring-jpa-oracle-demo 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:3.0.0:clean (default-clean) @ spring-jpa-oracle-demo ---
[INFO] Deleting D:\spring\apptracking\target
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ spring-jpa-oracle-demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ spring-jpa-oracle-demo ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 5 source files to D:\spring\apptracking\target\classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  7.467 s
[INFO] Finished at: 2019-08-31T16:13:50+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project spring-jpa-oracle-demo: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[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

when I have to run the project by intellij gave me:

I have upload the output here

log file output:

2019-08-31 16:23:06,993 [1871438]   INFO - rationStore.ComponentStoreImpl - Saving Project 'D:\spring\apptracking' apptrackinglibraryTable took 11 ms 
2019-08-31 16:23:07,069 [1871514]   INFO - ij.compiler.impl.CompileDriver - COMPILATION STARTED (BUILD PROCESS) 
2019-08-31 16:23:07,631 [1872076]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stdout]: Build process started. Classpath: C:/Program Files/JetBrains/IntelliJ IDEA 2019.2.1/plugins/java/lib/jps-launcher.jar;C:/Program Files/Java/jdk1.8.0_221/lib/tools.jar 
2019-08-31 16:23:07,709 [1872154]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 
2019-08-31 16:23:07,709 [1872154]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Defaulting to no-operation (NOP) logger implementation 
2019-08-31 16:23:07,709 [1872154]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 
2019-08-31 16:23:12,358 [1876803]   INFO - pl.ProjectRootManagerComponent - project roots have changed 
2019-08-31 16:23:12,364 [1876809]   INFO - lij.compiler.impl.CompilerUtil -     COMPILATION FINISHED (BUILD PROCESS); Errors: 0; warnings: 0 took 5228 ms: 0 min 5sec 
2019-08-31 16:23:12,490 [1876935]   INFO - s.CompilerReferenceServiceBase - backward reference index reader is opened 
2019-08-31 16:23:12,491 [1876936]   INFO - .diagnostic.PerformanceWatcher - Pushing properties took 3ms; general responsiveness: ok; EDT responsiveness: ok 
2019-08-31 16:23:12,542 [1876987]   INFO - .diagnostic.PerformanceWatcher - Indexable file iteration took 51ms; general responsiveness: ok; EDT responsiveness: ok 
2019-08-31 16:23:13,909 [1878354]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stdout]: Build process started. Classpath: C:/Program Files/JetBrains/IntelliJ IDEA 2019.2.1/plugins/java/lib/jps-launcher.jar;C:/Program Files/Java/jdk1.8.0_221/lib/tools.jar 
2019-08-31 16:23:13,910 [1878355]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 
2019-08-31 16:23:13,910 [1878355]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Defaulting to no-operation (NOP) logger implementation 
2019-08-31 16:23:13,910 [1878355]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 
2019-08-31 16:23:31,105 [1895550]   INFO - rationStore.ComponentStoreImpl - Saving appFileTypeManager took 17 ms 
2019-08-31 16:23:31,133 [1895578]   INFO - rationStore.ComponentStoreImpl - Saving Project 'D:\spring\apptracking' apptrackinglibraryTable took 14 ms 
2019-08-31 16:24:00,974 [1925419]   INFO - rationStore.ComponentStoreImpl - Saving Project 'D:\spring\apptracking' apptrackinglibraryTable took 15 ms 
2019-08-31 16:24:01,054 [1925499]   INFO - ij.compiler.impl.CompileDriver - COMPILATION STARTED (BUILD PROCESS) 
2019-08-31 16:24:01,623 [1926068]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stdout]: Build process started. Classpath: C:/Program Files/JetBrains/IntelliJ IDEA 2019.2.1/plugins/java/lib/jps-launcher.jar;C:/Program Files/Java/jdk1.8.0_221/lib/tools.jar 
2019-08-31 16:24:01,704 [1926149]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 
2019-08-31 16:24:01,704 [1926149]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Defaulting to no-operation (NOP) logger implementation 
2019-08-31 16:24:01,704 [1926149]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 
2019-08-31 16:24:05,327 [1929772]   INFO - lij.compiler.impl.CompilerUtil -     COMPILATION FINISHED (BUILD PROCESS); Errors: 0; warnings: 0 took 4280 ms: 0 min 4sec 
2019-08-31 16:24:05,334 [1929779]   INFO - s.CompilerReferenceServiceBase - backward reference index reader is opened 
2019-08-31 16:24:06,073 [1930518]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stdout]: Build process started. Classpath: C:/Program Files/JetBrains/IntelliJ IDEA 2019.2.1/plugins/java/lib/jps-launcher.jar;C:/Program Files/Java/jdk1.8.0_221/lib/tools.jar 
2019-08-31 16:24:06,173 [1930618]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". 
2019-08-31 16:24:06,173 [1930618]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: Defaulting to no-operation (NOP) logger implementation 
2019-08-31 16:24:06,173 [1930618]   INFO - j.compiler.server.BuildManager - BUILDER_PROCESS [stderr]: SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. 

what I must to do?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Abd Al Rahman
  • 121
  • 2
  • 9

1 Answers1

1

Your IDE uses JDK, which stands for Java Development Kit (probably a bundled one). The key work here is development, i.e. JDK contains tools for developers, most notable a Java compiler, javac.

But it looks like your console is set up to use JRE, which is Java Runtime Environment. It's purpose is only running Java programs, but not compiling them, so, javac is not bundled in JRE.

Check if the javac is in yourt PATH by running javac -version from the console:

$ javac -version
javac 1.8.0_222

If it fails, add the JDK, not the JRE to the PATH or set it in JAVA_HOME environment variable. There are literaly dozens of articles in the Internet about Java, PATH and JAVA_HOME.

madhead
  • 31,729
  • 16
  • 153
  • 201
  • thanks dear, but i have done the environment variable correctly and when i type javac -version gave me java 1.8.0_111 – Abd Al Rahman Sep 05 '19 at 08:55
  • Thanks, was running a `JRE` only without `JDK`, aparrently thiught I had installed the JDK, now that works, On linux, run the command `sudo apt install openjdk-8-jdk-headless` and it auto installs the `JDK` for your system, change the version as u need – Jose Mhlanga Aug 20 '21 at 20:05