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

Building JRuby: some classes are not rebuilt properly by "mvn package" #1470

DavidEGrayson opened this issue Feb 1, 2014 · 3 comments


Copy link

@DavidEGrayson DavidEGrayson commented Feb 1, 2014

It seems that some classes in JRuby are not rebuilt properly by "mvn package". There are various tests in the test suite that compare one version number in JRuby to another and these often fail as a result. Those are just the most visible failures; there are probably some nastier ones that are not caught by any tests.

To demonstrate the problem, I ran the following Bash script in a new, empty directory:

set -ue
git clone jruby
cd jruby
mvn package
git checkout jruby-1_7
mvn package
bin/jruby -v -e 'p'

The output from the final command is:

jruby 1.7.11-SNAPSHOT (1.9.3p392) 2014-01-28 24536e0 on OpenJDK 64-Bit Server VM 1.7.0_51-b00 [linux-amd64]

So "jruby -v" reports the correct version, but the JRubyEngineFactory thinks we are running That class was probably compiled from the master branch and failed to get recompiled later.

Using grep I can see that only one class contains the string "":

$ grep -r .
# Binary file ./core/target/classes/org/jruby/embed/jsr223/JRubyEngineFactory.class matches

Here is my maven version info:

$  mvn --version
Apache Maven 3.1.1 (NON-CANONICAL_2013-10-11_13-55_root; 2013-10-11 02:55:32-0700)
Maven home: /opt/maven
Java version: 1.7.0_51, vendor: Oracle Corporation
Java home: /usr/lib/jvm/java-7-openjdk/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "3.12.8-1-arch", arch: "amd64", family: "unix"

Here is my ant version info:

$  ant -version
Apache Ant(TM) version 1.9.3 compiled on January 19 2014
Copy link

@mkristian mkristian commented Feb 2, 2014

$ mvn compile uses incremental compilation. so whatever changes by
switching branches will be recompiled.

after switching the branch you need to run
$ mvn clean package
to force a clean compilation.

to fix your usecase would mean to turn off incremental compilation - not
sure if that is wanted for the common usecase - rebuild without switching

Copy link
Contributor Author

@DavidEGrayson DavidEGrayson commented Feb 2, 2014

Thank you very much for explaining, @mkristian. I should have said I am new to this stuff and not totally sure if it is a bug.

Running "mvn clean" after switching branches fixed the problem. Requiring "mvn clean" once in a while should not be a problem; I think in a typical C project if some compilation options or metadata in the Makefile changed you would have to do "make clean".

Should I submit a pull request that adds your information to It doesn't actually say how to clean or do an incremental compile.

Copy link

@mkristian mkristian commented Feb 2, 2014

please do the PR !!

DavidEGrayson added a commit to DavidEGrayson/jruby that referenced this issue Feb 2, 2014
…ntence about cleaning after switching branches.

This information is derived from a comment by mkristian:
jruby#1470 (comment)
mkristian added a commit that referenced this issue Feb 3, 2014
…ntence about cleaning after switching branches.

This information is derived from a comment by mkristian:
#1470 (comment)

[skip ci]
@enebo enebo added this to the JRuby 1.7.11 milestone Feb 21, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants