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

--example not working #557

Closed
ltboye opened this issue Sep 25, 2018 · 15 comments
Closed

--example not working #557

ltboye opened this issue Sep 25, 2018 · 15 comments
Assignees

Comments

@ltboye
Copy link

ltboye commented Sep 25, 2018

Characteristics

  • Issue Type: bug
  • Reproducibility: always
  • Severity: major
  • Tool/Service/Component: DSpot 1.1.1
  • Execution Environment: Windows 10
  • Reporter: Lars Thomas Boye

Description

Starting to test DSpot again, I tried to run with --example as described in the readme. I get a compilation error (see below). I have JAVA_HOME pointing to a Java 8 jdk.

Command Line / Options

java -jar target/dspot-USED-VERSION-jar-with-dependencies.jar --example

[INFO] 2018-09-25 13:25:38 EntryPoint - Path to runner Classes: E:\Dev\stamp\dspot\dspot\target\dspot.jar
[INFO] 2018-09-25 13:25:38 EntryPoint - E:\Dev\stamp\dspot\dspot\target\dspot.jar
[INFO] 2018-09-25 13:25:38 EntryPoint - E:\Dev\stamp\dspot\dspot\target\dspot.jar
[INFO] 2018-09-25 13:25:38 EntryPoint - E:\Dev\stamp\dspot\dspot\target\dspot.jar
[WARN] 2018-09-25 13:25:38 AutomaticBuilderFactory - automaticBuilderName: unknown automatic builder specified in configuration, going to default.
[INFO] 2018-09-25 13:25:38 AutomaticBuilderFactory - Default: provided Maven automatic builder.
[INFO] 2018-09-25 13:25:38 MavenAutomaticBuilder - run maven clean test -DskipTests dependency:build-classpath -Dmdep.outputFile=target/dspot/classpath
[WARN] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< example:example >---------------------------
[INFO] Building test-projects 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ example ---
[INFO] Deleting E:\Dev\stamp\dspot\dspot\src\test\resources\test-projects\target
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ example ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\Dev\stamp\dspot\dspot\src\test\resources\test-projects\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ example ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to E:\Dev\stamp\dspot\dspot\src\test\resources\test-projects\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: 1.100 s
[INFO] Finished at: 2018-09-25T13:25:40+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project example: 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
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: java.io.FileNotFoundException: E:\Dev\stamp\dspot\dspot\src\test\resources\test-projects\target\dspot\classpath (Systemet finner ikke angitt bane)
at eu.stamp_project.Main.runExample(Main.java:101)
at eu.stamp_project.Main.main(Main.java:38)
Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: E:\Dev\stamp\dspot\dspot\src\test\resources\test-projects\target\dspot\classpath (Systemet finner ikke angitt bane)
at eu.stamp_project.automaticbuilder.MavenAutomaticBuilder.compileAndBuildClasspath(MavenAutomaticBuilder.java:91)
at eu.stamp_project.program.InputConfiguration.initializeBuilder(InputConfiguration.java:150)
at eu.stamp_project.program.InputConfiguration.initialize(InputConfiguration.java:101)
at eu.stamp_project.program.InputConfiguration.initialize(InputConfiguration.java:71)
at eu.stamp_project.Main.runExample(Main.java:95)
... 1 more
Caused by: java.io.FileNotFoundException: E:\Dev\stamp\dspot\dspot\src\test\resources\test-projects\target\dspot\classpath (Systemet finner ikke angitt bane)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.(Unknown Source)
at java.io.FileReader.(Unknown Source)
at eu.stamp_project.automaticbuilder.MavenAutomaticBuilder.compileAndBuildClasspath(MavenAutomaticBuilder.java:88)
... 5 more

@ltboye
Copy link
Author

ltboye commented Sep 25, 2018

Same error also when trying to run on a real project.

@danglotb
Copy link
Member

It appears that your JAVA_HOME and maven are not properly set up:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project example: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

A suggest to you to fix your maven install by making the environment variable JAVA_HOME pointing to a JDK.

After a quick look, I found a plenty solutions, e.g. this

Cheers

@ltboye
Copy link
Author

ltboye commented Sep 25, 2018

As I said, JAVA_HOME points to a Java 8 jdk, so it is correct.

From mvn -version:
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T20:33:14+02:00)
Maven home: C:\Dev\apache-maven-3.5.4\bin..
Java version: 1.8.0_172, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk1.8.0_172\jre
Default locale: no_NO, platform encoding: Cp1252
OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

The path shown in mvn -version is the correct jdk. It adds \jre, which is correct according to the stackoverflow link you gave above.

@danglotb
Copy link
Member

Do you have more than one maven installation? Could you please look at the values of the following environment variables: MAVEN_HOME, M2_HOME?

As I said, JAVA_HOME points to a Java 8 jdk, so it is correct.

Sorry, read to fast.

Best.

@danglotb danglotb self-assigned this Sep 25, 2018
@ltboye
Copy link
Author

ltboye commented Sep 25, 2018

I do have an older maven installation on my machine (3.3.9). Should I remove it?
MAVEN_HOME is C:\Dev\apache-maven-3.5.4, which is the version I currently use. This with \bin is included in PATH.

I do not have M2_HOME. Interestingly, according to 3.5 release notes, it is no longer supported:
https://maven.apache.org/docs/3.5.0/release-notes.html

@danglotb
Copy link
Member

I do have an older maven installation on my machine (3.3.9). Should I remove it?

Could you? It will remove one of my doubt :)

I do not have M2_HOME. Interestingly, according to 3.5 release notes, it is no longer supported:
https://maven.apache.org/docs/3.5.0/release-notes.html

Thank you for the pointer

@ltboye
Copy link
Author

ltboye commented Sep 25, 2018

I deleted the old maven (I don't use it any more anyway). Still the same error when trying to run dspot.

@danglotb
Copy link
Member

danglotb commented Oct 2, 2018

Hi @ltboye

Could you retry and copy/paste the full logs of the execution? I added some logs.

Since I cannot reproduce on my side the errors, it is complicated for me to understand what is happening.

@ltboye
Copy link
Author

ltboye commented Oct 2, 2018

Sure, this is after building the latest from master:

2018-10-02 14:48:25,120 INFO eu.stamp_project.testrunner.EntryPoint - Path to runner Classes: E:\Dev\stamp\dspot\dspot\target\dspot.jar
2018-10-02 14:48:25,120 INFO eu.stamp_project.testrunner.EntryPoint - E:\Dev\stamp\dspot\dspot\target\dspot.jar
2018-10-02 14:48:25,120 INFO eu.stamp_project.testrunner.EntryPoint - E:\Dev\stamp\dspot\dspot\target\dspot.jar
2018-10-02 14:48:25,120 INFO eu.stamp_project.testrunner.EntryPoint - E:\Dev\stamp\dspot\dspot\target\dspot.jar
2018-10-02 14:48:25,120 WARN eu.stamp_project.automaticbuilder.AutomaticBuilderFactory - automaticBuilderName: unknown automatic builder specified in configuration, going to default.
2018-10-02 14:48:25,120 INFO eu.stamp_project.automaticbuilder.AutomaticBuilderFactory - Default: provided Maven automatic builder.
2018-10-02 14:48:25,135 INFO eu.stamp_project.automaticbuilder.MavenAutomaticBuilder - Using C:\Dev\apache-maven-3.5.4 for maven home
2018-10-02 14:48:25,135 INFO eu.stamp_project.automaticbuilder.MavenAutomaticBuilder - run maven: C:\Dev\apache-maven-3.5.4/bin/mvn clean test -DskipTests dependency:build-classpath -Dmdep.outputFile=target/dspot/classpath
[WARN] Maven will be executed in interactive mode, but no input stream has been configured for this MavenInvoker instance.
[INFO] Scanning for projects...
[INFO]
[INFO] --------------------------< example:example >---------------------------
[INFO] Building test-projects 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ example ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ example ---
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent!
[INFO] skip non existing resourceDirectory E:\Dev\stamp\dspot\dspot\src\test\resources\test-projects\src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ example ---
[INFO] Changes detected - recompiling the module!
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent!
[INFO] Compiling 1 source file to E:\Dev\stamp\dspot\dspot\src\test\resources\test-projects\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: 1.454 s
[INFO] Finished at: 2018-10-02T14:48:28+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.7.0:compile (default-compile) on project example: 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
Exception in thread "main" java.lang.RuntimeException: java.lang.RuntimeException: java.io.FileNotFoundException: E:\Dev\stamp\dspot\dspot\src\test\resources\test-projects\target\dspot\classpath (Systemet finner ikke angitt bane)
at eu.stamp_project.Main.runExample(Main.java:101)
at eu.stamp_project.Main.main(Main.java:38)
Caused by: java.lang.RuntimeException: java.io.FileNotFoundException: E:\Dev\stamp\dspot\dspot\src\test\resources\test-projects\target\dspot\classpath (Systemet finner ikke angitt bane)
at eu.stamp_project.automaticbuilder.MavenAutomaticBuilder.compileAndBuildClasspath(MavenAutomaticBuilder.java:91)
at eu.stamp_project.program.InputConfiguration.initializeBuilder(InputConfiguration.java:150)
at eu.stamp_project.program.InputConfiguration.initialize(InputConfiguration.java:101)
at eu.stamp_project.program.InputConfiguration.initialize(InputConfiguration.java:71)
at eu.stamp_project.Main.runExample(Main.java:95)
... 1 more
Caused by: java.io.FileNotFoundException: E:\Dev\stamp\dspot\dspot\src\test\resources\test-projects\target\dspot\classpath (Systemet finner ikke angitt bane)
at java.io.FileInputStream.open0(Native Method)
at java.io.FileInputStream.open(Unknown Source)
at java.io.FileInputStream.(Unknown Source)
at java.io.FileReader.(Unknown Source)
at eu.stamp_project.automaticbuilder.MavenAutomaticBuilder.compileAndBuildClasspath(MavenAutomaticBuilder.java:88)
... 5 more

@danglotb
Copy link
Member

danglotb commented Oct 2, 2018

I am sorry, but I don't know.

Is it possible that maven does not find its maven home because you are executing DSpot on E: and maven is installed on C:?

I ran out of ideas, I am sorry.

@ltboye
Copy link
Author

ltboye commented Oct 2, 2018

I will try to move DSpot to C:.

Have you verified this version of DSpot working on Windows 10?

@ltboye
Copy link
Author

ltboye commented Oct 2, 2018

I tried on C:, and it gives the same error.

I hope in a little while someone at Tellu with a Linux system will try DSpot.

@ltboye
Copy link
Author

ltboye commented Oct 17, 2018

Hi @danglotb

Looking at this issue again, I have found two suggestions which may be worth trying.

One is to run Maven with -Dtools_jar_location

The other is to add this configuration to the maven-compiler-plugin in the pom:

path to javac.exe

Is it possible for me to try these things by modifying the DSpot source? If you point out where, I can try to experiment.

@danglotb
Copy link
Member

danglotb commented Oct 17, 2018

Hi @ltboye

I am not sure that I understand your solution.

But, if you want to add an option in the maven goals you can have a look to the eu.stamp_project.automaticbuilder.MavenAutomaticBuilder class.

More precisely, the method runGoals() which the method that actually run the mvn command with specific goals (e.g. mvn clean test to clean and launch the test of the project).

The other is to add this configuration to the maven-compiler-plugin in the pom:

I do not like the idea of modifying the pom.xml automatically of the "client" project because no one likes that a bot touch our stuff and it can be messy.

@danglotb
Copy link
Member

Closing this issue. Please reopen it or open a new one. Thank you.

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