Skip to content

Remove the org.jruby.ant Ant tasks and the Ant build dependency - #9766

Draft
zev wants to merge 1 commit into
jruby:masterfrom
zev:remove-jruby-ant-tasks
Draft

zev wants to merge 1 commit into
jruby:masterfrom
zev:remove-jruby-ant-tasks

Conversation

@zev

@zev zev commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Follow-up to #9761, which removes Ant from JRuby's rake tasks. This removes the last Ant code in JRuby itself.

What org.jruby.ant was

org.jruby.ant.Rake and RakeImport are Ant tasks that let an Ant build.xml call Rake. That's the opposite direction from the rake-ant gem, which lets a Rakefile call Ant:

<taskdef name="rake" classname="org.jruby.ant.Rake"/>
<rake task="default"/>

RakeTaskBase starts a ScriptingContainer and calls require 'ant/tasks/raketasks' to get a RakeWrapper.

They have been broken since 2017

In 63be80b ("Remove ant DSL/wrapper from stdlib and replace with gem", JRuby 9.2), that file moved into the rake-ant gem as rake/ant/tasks/raketasks.rb, but RakeTaskBase was never updated. On current master, require 'ant/tasks/raketasks' raises LoadError, so both tasks fail as soon as they're constructed. Nothing in JRuby or rake-ant references org.jruby.ant.

Changes

  • Delete core/src/main/java/org/jruby/ant/ (3 files, about 100 lines).
  • Remove the provided org.apache.ant:ant dependency from core/pom.rb and test/pom.rb, and the ant.version property from pom.rb. The pom.xml files are regenerated.
  • Remove an unused org.apache.tools.ant.util.CollectionUtils import from AddCallProtocolInstructions.
  • In ReaderInputStreamTest, use Files.readString(..., Charset.defaultCharset()) instead of Ant's FileUtils.readFully(new FileReader(...)). Both read with the default charset.

ant-commons-net, which is declared on maven-antrun-plugin in pom.rb, is unrelated and stays.

Question: move the tasks to rake-ant, or drop them?

Old codebases might still have a build.xml that taskdefs org.jruby.ant.Rake, although it can't have worked on any JRuby since 9.2. The Ruby half (RakeWrapper) already lives in rake-ant. Should these Java tasks go there too? That would mean adding a Java build to rake-ant and fixing the require path. Or should they just be dropped? If they're dropped, RakeWrapper in rake-ant has no callers and could be removed there later.

Testing

Temurin 21, no Ant installed:

  • ./mvnw -Pbootstrap clean package passes, and the built jars contain no org/jruby/ant/ classes.
  • ./mvnw -Ptest -pl core test -Dtest=ReaderInputStreamTest: all core test sources compile without the Ant jar, and the test passes (10/10).

Co-authored with Claude Code

org.jruby.ant.Rake and RakeImport let an Ant build.xml run Rake through
<taskdef>. They require 'ant/tasks/raketasks', which left JRuby when the
Ant integration moved to the rake-ant gem (63be80b, 2017); the gem
ships it as rake/ant/tasks/raketasks, so the tasks have failed with a
LoadError since then.

With them gone nothing in JRuby compiles against Ant, so drop the
provided org.apache.ant:ant dependency from core and test and the
ant.version property. Remove an unused Ant import from
AddCallProtocolInstructions and read the expected file with
java.nio.file.Files in ReaderInputStreamTest instead of Ant's FileUtils.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@headius

headius commented Oct 2, 2026

Copy link
Copy Markdown
Member

Question: move the tasks to rake-ant, or drop them?

We should create a new Maven artifact org.jruby:jruby-ant so it's available for any remaining Ant + Rake users out there.

Or ant-jruby? ant-tasks? Just ant?

I feel like I've already spent too much brainpower thinking about it. 😀

Given that this will require a new repo etc I'll create that quickly and get it set up.

@headius

headius commented Oct 2, 2026

Copy link
Copy Markdown
Member

It's live: https://github.com/jruby/jruby-ant

Publishing isn't fully set up but snapshot deploy works. No tests because apparently we don't have any.

@headius

headius commented Oct 2, 2026

Copy link
Copy Markdown
Member

cc @enebo if you have any thoughts on the new jruby-ant artifact

@zev

zev commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @headius for creating jruby/jruby-ant. I opened a draft PR there that gets it ready to publish: jruby/jruby-ant#1

  • It fixes the require path (rake/ant/tasks/raketasks) and a bug where RakeImport never passed -f to Rake.
  • It adds unit and integration tests, a CI workflow and the Maven wrapper.
  • It adds Central-ready pom metadata and a release profile with sources, javadoc and GPG signing. Please check the signing setup.

🤖 Generated with Claude Code

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

Successfully merging this pull request may close these issues.

2 participants