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

Closed
DavidEGrayson opened this Issue Feb 1, 2014 · 3 comments

Comments

Projects
None yet
3 participants
@DavidEGrayson
Copy link
Contributor

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 https://github.com/jruby/jruby.git jruby
cd jruby
mvn package
git checkout jruby-1_7
mvn package
bin/jruby -v -e 'p org.jruby.embed.jsr223.JRubyEngineFactory.new.getEngineVersion'

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]
"9000.dev"

So "jruby -v" reports the correct version, but the JRubyEngineFactory thinks we are running 9000.dev. 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 "9000.dev":

$ grep 9000.dev -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
@mkristian

This comment has been minimized.

Copy link
Member

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
branches.

@DavidEGrayson

This comment has been minimized.

Copy link
Contributor Author

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 BUILDING.md? It doesn't actually say how to clean or do an incremental compile.

@mkristian

This comment has been minimized.

Copy link
Member

commented Feb 2, 2014

please do the PR !!

DavidEGrayson added a commit to DavidEGrayson/jruby that referenced this issue Feb 2, 2014

BUILDING.md: Added a new section about incremental compiling and a se…
…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

BUILDING.md: Added a new section about incremental compiling and a se…
…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
You can’t perform that action at this time.