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

Ruby Maven Compilation Error : No compiler is provided in this environment #6

Open
mbnetobr opened this issue Dec 22, 2014 · 11 comments

Comments

@mbnetobr
Copy link

Hi guys,

I'm try use ruby maven to write some scritps with ruby and maven. When i'm execute
this short script:

require 'maven/ruby/maven'
mvn = Maven::Ruby::Maven.new
mvn.exec('install', '-f' '.myProject/pom.xml' )

I'm receive this error message:

[ERROR] COMPILATION ERROR
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
[INFO] 1 error
[INFO] BUILD FAILURE

My Java_Home is correct setted. The pure command "mvn install" on project diretory works normally and occurs build sucess. But i'm need call maven inside ruby script.

My environment:
Windows7 Professional 64x
Ruby 193;
Maven 3.1.1 MAVEN_HOME = C:\apache-maven-3.1.1
Java 1.7.0_51; JAVA_HOME = C:\Program Files\Java\jdk1.7.0_51

@mkristian
Copy link
Owner

could you please add

mvn.verbose = true
mvn.debug = true

to see more what is going on.

ruby-maven comes with its own maven version which is 3.1.1 (same as yours).

but it looks like there is a missing "," in your script, try this:
mvn.exec('install', '-f', '.myProject/pom.xml' )

@mbnetobr
Copy link
Author

This problem occurs on configuration of the eclipse, see that post, but i dont use eclipse.
http://stackoverflow.com/questions/19655184/no-compiler-is-provided-in-this-environment-perhaps-you-are-running-on-a-jre-ra.

I'm try run this script:
require 'maven/ruby/maven'

mvn = Maven::Ruby::Maven.new
mvn.verbose = true
mvn.debug = true
mvn.exec('install', '-f', 'pom.xml' )

Occurs that:

mvn debug= true
using java invokation
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Project - My Project 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.544s
[INFO] Finished at: Tue Dec 23 10:28:17 BOT 2014
[INFO] Final Memory: 7M/17M
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase "debug=". You must specify a valid lifecycle pha
se or a goal in the format : or :[:]:. Available lifecycle phases are: validate,
initialize, generate-sources, process-sources, generate-resources, process-reso
urces, compile, process-classes, generate-test-sources, process-test-sources, ge
nerate-test-resources, process-test-resources, test-compile, process-test-classe
s, test, prepare-package, package, pre-integration-test, integration-test, post-
integration-test, verify, install, deploy, pre-site, site, post-site, site-deplo
y, pre-clean, clean, post-clean. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/LifecyclePhase
NotFoundException

mvn install -f pom.xml
using java invokation
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building My Project - Project 1.0.0
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- properties-maven-plugin:1.0-alpha-2:read-project-properties (default)
@ Project ---
[INFO]
[INFO] --- android-maven-plugin:3.9.0-rc.2:generate-sources (default-generate-so
urces) @ Project ---
[INFO] Extracting libs
[INFO] Generating R file for com.sec:Project :aar:1.
3.0
[INFO] Adding R gen folder to compile classpath: C:\Users\manuel.neto\Documents
Project \target\generated-sources\r
[INFO] Adding AIDL gen folder to compile classpath: C:\Users\manuel.neto\Documen
ts\Project \target\generated-sources\aidl
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ Project ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\manuel.neto\Documents\Project \src\main\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ Project ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 87 source files to C:\Users\manuel.neto\Documents\Project \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.780s
[INFO] Finished at: Tue Dec 23 10:28:20 BOT 2014
[INFO] Final Memory: 11M/30M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.
1:compile (default-compile) on project Project : Com
pilation failure

@mkristian
Copy link
Owner

hmm,

which version of ruby-maven are you using ?

just two observations: remove the mvn.debug line in your script.

there is a space in path to your project - well it is a long shot but
spaces create problems once in a while.

more questions:

  • what does rmvn --version show ?
  • does rmvn -f pom.xml work ?

@mbnetobr
Copy link
Author

which version of ruby-maven are you using ?

  • Ruby Maven 3.1.1.0.08

just two observations: remove the mvn.debug line in your script.

  • Done
    there is a space in path to your project - well it is a long shot but spaces create problems once in a while.
  • I'm need to edit name of the project, because that you see spaces.

does rmvn -f pom.xml work ?
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.498s
[INFO] Finished at: Tue Dec 23 11:44:44 BOT 2014
[INFO] Final Memory: 6M/16M
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid li
fecycle phase or a goal in the format : or <plugin-group-id

:[:]:. Available lifecycle phases are
: validate, initialize, generate-sources, process-sources, generate-resources, p
rocess-resources, compile, process-classes, generate-test-sources, process-test-
sources, generate-test-resources, process-test-resources, test-compile, process-
test-classes, test, prepare-package, package, pre-integration-test, integration-
test, post-integration-test, verify, install, deploy, pre-site, site, post-site,
site-deploy, pre-clean, clean, post-clean. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
ch.
[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 rea
d the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoGoalSpecifie
dException

what does rmvn --version show ?
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 11:22:2
2-0400)
Maven home: C:\Ruby193\lib\ruby\gems\1.9.1\gems\ruby-maven-libs-3.1.1
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: C:\Program Files (x86)\Java\jre7
Default locale: pt_BR, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"

I think the problem is this line:
Java home: C:\Program Files (x86)\Java\jre7

@mkristian
Copy link
Owner

is javac.exe on your PATH variable ?

you also can try setting -Dmaven.compiler.fork=true

@mbnetobr
Copy link
Author

is javac.exe on your PATH variable ?
I dont understand this question.
On local maven, my Java home is that: Java home: C:\Program Files\Java\jdk1.7.0_51\jre. Is possible change on ruby-maven?

you also can try setting -Dmaven.compiler.fork=true

  • How ?

@mkristian
Copy link
Owner

the debug of maven basically says that it looks javac on the environment.
i.e. can you execute javac from the console (forgot how this block terminal
window is called on windows) ?

inside your script you can do this:

mvn.property('maven.compiler.fork', true)

On Tue, Dec 23, 2014 at 6:07 PM, mbnetobr notifications@github.com wrote:

is javac.exe on your PATH variable ?
I dont understand this question.
On local maven, my Java home is that: Java home: C:\Program
Files\Java\jdk1.7.0_51\jre. Is possible change on ruby-maven?

you also can try setting -Dmaven.compiler.fork=true

  • How ?


Reply to this email directly or view it on GitHub
#6 (comment).

@mbnetobr
Copy link
Author

Use mvn.property('maven.compiler.fork', true) works.

Build Sucess, thanks :) 👍

@mkristian
Copy link
Owner

still unsure why, but I do not have a windows to investigate further. so I
just happy it works for you now ;)

@mbnetobr
Copy link
Author

I'm investigate more and return later.

Please dont close this issue.

@mbnetobr
Copy link
Author

The problem occurs because my machine has a incorret JRE installed.
The problem to build my application occurs at this line on ruby maven:
Java home: C:\Program Files (x86)\Java\jre7

On Windows terminal when i'm execute:
"rmvn -version"
Apache Maven 3.1.1 (0728685237757ffbf44136acec0402957f723d9a; 2013-09-17 11:22:2
2-0400)
Maven home: C:\Ruby193\lib\ruby\gems\1.9.1\gems\ruby-maven-libs-3.1.1
Java version: 1.7.0_45, vendor: Oracle Corporation
Java home: C:\Program Files (x86)\Java\jre7
Default locale: pt_BR, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "x86", family: "windows"

I'm dont know but ruby maven catch wrong version of the JRE on my machine. My machine is 64bits and the JRE installed was 32bits.

So i'm remove JRE7 (32bits) on control painel of the windows and install the correct version to my machine, JRE7 (64bits).

After that when i'm execute, rmvn --version, terminal returns:
Maven home: C:\Ruby193\lib\ruby\gems\1.9.1\gems\ruby-maven-libs-3.1.1
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: C:\Program Files\Java\jdk1.7.0_51\jre
Default locale: pt_BR, platform encoding: Cp1252
OS name: "windows 7", version: "6.1", arch: "amd64", family: "windows"

In my case is necessary Java home configured to JRE inside of the JDK version. After this process i dont have more problems.

So thanks.

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