You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildr.apache.org by "Rhett Sutphin (JIRA)" <ji...@apache.org> on 2010/07/02 00:02:51 UTC

[jira] Created: (BUILDR-463) Setting a system property in the buildfile causes a NoClassDefFoundError

Setting a system property in the buildfile causes a NoClassDefFoundError
------------------------------------------------------------------------

                 Key: BUILDR-463
                 URL: https://issues.apache.org/jira/browse/BUILDR-463
             Project: Buildr
          Issue Type: Bug
          Components: Core features
    Affects Versions: 1.4
         Environment: MRI 1.8.7-p174
(does not happen on JRuby)
            Reporter: Rhett Sutphin


If a buildfile sets a system property like so:

    Java.java.lang.System.setProperty("foo", "bar")

a subsequent attempt to run JUnit tests will fail with a NoClassDefFoundError for org/apache/buildr/JavaTestFilter.  A minimal project which demonstrates this can be found in this gist: http://gist.github.com/460611 .  Clone it and then run `buildr clean test` to replicate.

This worked in 1.3.5.  It continues to work in 1.4.0 in JRuby, but not in MRI.

(Apologies for not catching this in an RC -- most of my prerelease testing was with a different project that didn't do this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (BUILDR-463) Setting a system property in the buildfile causes a NoClassDefFoundError

Posted by "Antoine Toulme (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BUILDR-463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Antoine Toulme resolved BUILDR-463.
-----------------------------------

    Resolution: Fixed

Fixed!

22:31:05~/w/buildr>svn ci CHANGELOG lib/buildr/java/rjb.rb -m "BUILDR-463 Setting a system property in the buildfile causes a NoClassDefFoundError"
Sending        CHANGELOG
Sending        lib/buildr/java/rjb.rb
Transmitting file data ..
Committed revision 959862.

> Setting a system property in the buildfile causes a NoClassDefFoundError
> ------------------------------------------------------------------------
>
>                 Key: BUILDR-463
>                 URL: https://issues.apache.org/jira/browse/BUILDR-463
>             Project: Buildr
>          Issue Type: Bug
>          Components: Core features
>    Affects Versions: 1.4
>         Environment: MRI 1.8.7-p174
> (does not happen on JRuby)
>            Reporter: Rhett Sutphin
>            Assignee: Antoine Toulme
>             Fix For: 1.4.1
>
>
> If a buildfile sets a system property like so:
>     Java.java.lang.System.setProperty("foo", "bar")
> a subsequent attempt to run JUnit tests will fail with a NoClassDefFoundError for org/apache/buildr/JavaTestFilter.  A minimal project which demonstrates this can be found in this gist: http://gist.github.com/460611 .  Clone it and then run `buildr clean test` to replicate.
> This worked in 1.3.5.  It continues to work in 1.4.0 in JRuby, but not in MRI.
> (Apologies for not catching this in an RC -- most of my prerelease testing was with a different project that didn't do this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (BUILDR-463) Setting a system property in the buildfile causes a NoClassDefFoundError

Posted by "Hudson (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BUILDR-463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12884569#action_12884569 ] 

Hudson commented on BUILDR-463:
-------------------------------

Integrated in Buildr-ci-build #51 (See [http://hudson.zones.apache.org/hudson/job/Buildr-ci-build/51/])
    BUILDR-463 Setting a system property in the buildfile causes a NoClassDefFoundError


> Setting a system property in the buildfile causes a NoClassDefFoundError
> ------------------------------------------------------------------------
>
>                 Key: BUILDR-463
>                 URL: https://issues.apache.org/jira/browse/BUILDR-463
>             Project: Buildr
>          Issue Type: Bug
>          Components: Core features
>    Affects Versions: 1.4
>         Environment: MRI 1.8.7-p174
> (does not happen on JRuby)
>            Reporter: Rhett Sutphin
>            Assignee: Antoine Toulme
>             Fix For: 1.4.1
>
>
> If a buildfile sets a system property like so:
>     Java.java.lang.System.setProperty("foo", "bar")
> a subsequent attempt to run JUnit tests will fail with a NoClassDefFoundError for org/apache/buildr/JavaTestFilter.  A minimal project which demonstrates this can be found in this gist: http://gist.github.com/460611 .  Clone it and then run `buildr clean test` to replicate.
> This worked in 1.3.5.  It continues to work in 1.4.0 in JRuby, but not in MRI.
> (Apologies for not catching this in an RC -- most of my prerelease testing was with a different project that didn't do this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (BUILDR-463) Setting a system property in the buildfile causes a NoClassDefFoundError

Posted by "Antoine Toulme (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/BUILDR-463?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Antoine Toulme updated BUILDR-463:
----------------------------------

         Assignee: Antoine Toulme
    Fix Version/s: 1.4.1

Regression alert!

> Setting a system property in the buildfile causes a NoClassDefFoundError
> ------------------------------------------------------------------------
>
>                 Key: BUILDR-463
>                 URL: https://issues.apache.org/jira/browse/BUILDR-463
>             Project: Buildr
>          Issue Type: Bug
>          Components: Core features
>    Affects Versions: 1.4
>         Environment: MRI 1.8.7-p174
> (does not happen on JRuby)
>            Reporter: Rhett Sutphin
>            Assignee: Antoine Toulme
>             Fix For: 1.4.1
>
>
> If a buildfile sets a system property like so:
>     Java.java.lang.System.setProperty("foo", "bar")
> a subsequent attempt to run JUnit tests will fail with a NoClassDefFoundError for org/apache/buildr/JavaTestFilter.  A minimal project which demonstrates this can be found in this gist: http://gist.github.com/460611 .  Clone it and then run `buildr clean test` to replicate.
> This worked in 1.3.5.  It continues to work in 1.4.0 in JRuby, but not in MRI.
> (Apologies for not catching this in an RC -- most of my prerelease testing was with a different project that didn't do this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (BUILDR-463) Setting a system property in the buildfile causes a NoClassDefFoundError

Posted by "Rhett Sutphin (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BUILDR-463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12884738#action_12884738 ] 

Rhett Sutphin commented on BUILDR-463:
--------------------------------------

Thanks for the fix.  I want to clarify something in your comment:

> First, a workaround: if you do this you will be fine:
> test.enhance do
>  ... some java stuff
> end

I'm actually not setting the system property _for_ the tests -- it's just that setting it causes (caused) the tests to break.  If the project didn't use JUnit tests, I'm sure the next thing that needed RJB's classpath to be set would have broken instead.

>From the poking around I did trying to figure out what was causing this error yesterday, your fix seems reasonable to me.

> Setting a system property in the buildfile causes a NoClassDefFoundError
> ------------------------------------------------------------------------
>
>                 Key: BUILDR-463
>                 URL: https://issues.apache.org/jira/browse/BUILDR-463
>             Project: Buildr
>          Issue Type: Bug
>          Components: Core features
>    Affects Versions: 1.4
>         Environment: MRI 1.8.7-p174
> (does not happen on JRuby)
>            Reporter: Rhett Sutphin
>            Assignee: Antoine Toulme
>             Fix For: 1.4.1
>
>
> If a buildfile sets a system property like so:
>     Java.java.lang.System.setProperty("foo", "bar")
> a subsequent attempt to run JUnit tests will fail with a NoClassDefFoundError for org/apache/buildr/JavaTestFilter.  A minimal project which demonstrates this can be found in this gist: http://gist.github.com/460611 .  Clone it and then run `buildr clean test` to replicate.
> This worked in 1.3.5.  It continues to work in 1.4.0 in JRuby, but not in MRI.
> (Apologies for not catching this in an RC -- most of my prerelease testing was with a different project that didn't do this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (BUILDR-463) Setting a system property in the buildfile causes a NoClassDefFoundError

Posted by "Antoine Toulme (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/BUILDR-463?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12884546#action_12884546 ] 

Antoine Toulme commented on BUILDR-463:
---------------------------------------

So far this is a puzzling bug.
First, a workaround: if you do this you will be fine:
test.enhance do
  ... some java stuff
end

I could reproduce the problem with the sample project you sent, but could not make it happen in a smaller scale spec. I could also see it works well with 1.3.5.
The classpath seems to be set in the same way if you comment the Java line, yet RJB throws an exception in one case and not the other. 
The problem stems down to the Java line, it is calling RJB before we had the opportunity to run Java.load.

Java.load sets the classpath. The classpath must be set before RJB import is called for the first time.

Frankly, this feature happened to work before. There are no specs for it. I will commit a fix for it now, assuming it doesn't break anything. Going forward support for this feature might break again if we don't have specs for it.

> Setting a system property in the buildfile causes a NoClassDefFoundError
> ------------------------------------------------------------------------
>
>                 Key: BUILDR-463
>                 URL: https://issues.apache.org/jira/browse/BUILDR-463
>             Project: Buildr
>          Issue Type: Bug
>          Components: Core features
>    Affects Versions: 1.4
>         Environment: MRI 1.8.7-p174
> (does not happen on JRuby)
>            Reporter: Rhett Sutphin
>            Assignee: Antoine Toulme
>             Fix For: 1.4.1
>
>
> If a buildfile sets a system property like so:
>     Java.java.lang.System.setProperty("foo", "bar")
> a subsequent attempt to run JUnit tests will fail with a NoClassDefFoundError for org/apache/buildr/JavaTestFilter.  A minimal project which demonstrates this can be found in this gist: http://gist.github.com/460611 .  Clone it and then run `buildr clean test` to replicate.
> This worked in 1.3.5.  It continues to work in 1.4.0 in JRuby, but not in MRI.
> (Apologies for not catching this in an RC -- most of my prerelease testing was with a different project that didn't do this.)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.