jruby-gradle.github.io/news/index.html

577 lines
20 KiB
HTML

<html>
<head>
<link href='/stylesheets/foundation.css' rel='stylesheet'>
<link href='/stylesheets/jrubygradle.css' rel='stylesheet'>
<link href='/news.atom' rel='alternate' title='JRuby/Gradle News' type='application/atom+xml'>
<title>
JRuby/Gradle News
</title>
</head>
<body>
<a href='https://github.com/jruby-gradle'>
<img alt='Fork me on GitHub' data-canonical-src='https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png' src='https://camo.githubusercontent.com/365986a132ccd6a44c23a9169022c0b5c890c387/68747470733a2f2f73332e616d617a6f6e6177732e636f6d2f6769746875622f726962626f6e732f666f726b6d655f72696768745f7265645f6161303030302e706e67' style='position: absolute; top: 0; right: 0; border: 0;'>
</a>
<div id='main_nav'>
<ul>
<li>
<a href='/'>
Home
</a>
</li>
<li>
<a href='/docs/'>
Documentation
</a>
</li>
<li>
<a href='/community/'>
Community
</a>
</li>
<li>
<a href='/news/'>
News
</a>
</li>
<li>
<a href='/download/'>
Download
</a>
</li>
<li>
<a href='https://travis-ci.org/jruby-gradle/jruby-gradle-plugin'>
<img src='https://travis-ci.org/jruby-gradle/jruby-gradle-plugin.svg?branch=master'>
</a>
</li>
<li>
<a href='https://bintray.com/jruby-gradle/plugins'>
<img src='https://api.bintray.com/packages/jruby-gradle/plugins/jruby-gradle-plugin/images/download.svg'>
</a>
</li>
</ul>
</div>
<div id='content'>
<h1>
JRuby/Gradle News
</h1>
<div class='post'>
<h1>
<a href='/news/2015/09/18/jruby-gradle-1-1/'>JRuby/Gradle 1.1 'Dresden' released</a>
</h1>
<strong>
18 September 2015
</strong>
<div class='content'>
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>Since our <a href="/news/2015/08/04/jrubygradle-one-point-oh/">major 1.0
announcement</a> at this past year&#8217;s <a href="http://2015.jrubyconf.eu">JRubyConf EU</a>
we&#8217;ve had a pretty steady stream of improvements and bug fixes in a total
of four patch releases (1.0.0 - 1.0.4), so we&#8217;re due for a big meaty
feature release! The most impactful feature, sponsored in part by
<a href="https://lookout.com">Lookout, Inc.</a>, is the support for <strong>dependency
resolution without a 3rd party proxy.</strong></p>
</div>
<div class="paragraph">
<p>By default, JRuby/Gradle relies on a third party instance of the
<a href="https://github.com/torquebox/rubygems-servlets">rubygems-servlets</a> proxy
which represents a Rubygem repository in a Maven-compatible format, allowing
tools like Gradle or Maven to prepare a dependency graph using Ruby gems. With
1.1, codenamed "<a href="https://en.wikipedia.org/wiki/Dresden">Dresden</a>", release
we&#8217;ve <em>embedded</em> the proxy software directly into the Gradle process. With the
<code>rubygems()</code> function, users can use gem dependencies from
<strong>any</strong> repository, whether it&#8217;s a public repository like
<a href="https://rubygems.org">rubygems.org</a> or an internal Ruby gem repository.</p>
</div>
<div class="paragraph">
<p>Currently this behavior is <strong>defaulted to off</strong> so users must explicitly
enable it, e.g.:</p>
</div>
<div class="listingblock">
<div class="title">build.gradle</div>
<div class="content">
<pre class="CodeRay highlight nowrap"><code data-lang="gradle">/* add the latest jruby/gradle plugin */
buildscript {
repositories { jcenter() }
dependencies {
/* allow Gradle to resolve anything between 1.1.2 and 1.2.0 (exclusive) */
classpath &quot;com.github.jruby-gradle:jruby-gradle-plugin:[1.1.2,1.2)&quot;
}
}
apply plugin: 'com.github.jruby-gradle.base'
/* Disable the default repositories so we can add our own */
jruby {
defaultRepositories false
}
repositories {
/* use jcenter() so we can get JRuby itself */
jcenter()
/* use our new rubygems() function to add a rubygems repo */
rubygems('https://rubygems.org')
}
dependncies {
gems 'rubygems:sinatra:1.4.5'
}</code></pre>
</div>
</div>
<div class="admonitionblock warning">
<table>
<tr>
<td class="icon">
<i class="fa icon-warning" title="Warning"></i>
</td>
<td class="content">
In our beta testing of this feature, users on JDK7 may need to
increase their available "PermGen" space for more complex projects via the
<code>gradle.properties</code> setting of: <code>org.gradle.jvmargs="-XX:MaxPermSize=512m"</code>
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>Once this functionality has been deemed stable, it will be enabled <strong>by
default</strong> so please try it out, and as per usual, please report any bugs to the
<a href="https://github.com/jruby-gradle/jruby-gradle-plugin/issues">GitHub Issues</a>
page.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="other-notable-features"><a class="anchor" href="#other-notable-features"></a>Other Notable Features</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The
<a href="https://github.com/jruby-gradle/jruby-gradle-plugin/issues?q=milestone%3A%221.1.0+-+Dresden%22">full
list of changes/fixes</a> is rather long, so below is a summary of what we thing
are nifty and notable features in 1.1:</p>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="https://github.com/jruby-gradle/jruby-gradle-plugin/issues/131">#131</a>:
Provide a command-line property to change the version of JRuby at runtime
(<code>./gradlew -PjrubyVersion=9.0.1.0</code>)</p>
</li>
<li>
<p><a href="https://github.com/jruby-gradle/jruby-gradle-plugin/issues/211">#211</a>:
Default to <a href="http://jruby.org/2015/09/02/jruby-9-0-1-0.html">JRuby 9.0.1.0</a></p>
</li>
<li>
<p><a href="https://github.com/jruby-gradle/jruby-gradle-plugin/issues/200">#200</a>:
Reduced <code>.jar</code> file size by not packing <code>cache/*.gem</code> inside the archive.</p>
</li>
<li>
<p><a href="https://github.com/jruby-gradle/jruby-gradle-plugin/pull/208">#208</a>:
Ensure <code>gradle.rb</code> scripts use the same classpath, gems and jars as their
j <code>JRubyExec</code> counterparts</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="bug-fixes"><a class="anchor" href="#bug-fixes"></a>Bug fixes</h2>
<div class="sectionbody">
<div class="paragraph">
<p>And of course some bug fixes, most of which were backported and released as
part of <a href="/news/2015/09/10/jruby-gradle-1/">JRuby/Gradle 1.0.4</a>.</p>
</div>
<div class="ulist">
<ul>
<li>
<p><a href="https://github.com/jruby-gradle/jruby-gradle-plugin/issues/195">#195</a>:
Ensure released versions of the plugin are laid out in the Maven repository
correctly (allows specifying a version range dependency on the plugin itself
properly like in the above example)</p>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class='post'>
<h1>
<a href='/news/2015/09/10/jruby-gradle-1/'>v1.0.4 and a few squashed bugs</a>
</h1>
<strong>
10 September 2015
</strong>
<div class='content'>
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>We&#8217;ve just released a minor bug fix release of the
<a href="https://github.com/jruby-gradle/jruby-gradle-plugin/tree/release-1.0.x">1.0.x
branch</a> of the JRuby/Gradle core plugins. We wanted to get a few bug fixes out
to users before we release
<a href="https://github.com/jruby-gradle/jruby-gradle-plugin/milestones/1.1.0%20-%20Dresden">1.1.0
- Dresden</a>, a release which contains some great new features which are still
baking in the oven.</p>
</div>
<div class="paragraph">
<p>Upgrading to this release is as easy as editing your <code>build.gradle</code> files:</p>
</div>
<div class="listingblock">
<div class="title">build.gradle</div>
<div class="content">
<pre class="CodeRay highlight nowrap"><code data-lang="gradle">buildscript {
repositories { jcenter() }
dependencies {
classpath &quot;com.github.jruby-gradle:jruby-gradle-plugin:1.0.4&quot;
}
}
apply plugin: 'com.github.jruby-gradle.base'</code></pre>
</div>
</div>
<div class="paragraph">
<p>The full diff from
<a href="https://github.com/jruby-gradle/jruby-gradle-plugin/compare/v1.0.3&#8230;&#8203;v1.0.4">1.0.3
to 1.0.4 can be found here</a>.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="improvements"><a class="anchor" href="#improvements"></a>Improvements</h2>
<div class="sectionbody">
<div class="ulist">
<ul>
<li>
<p><a href="https://github.com/jruby-gradle/jruby-gradle-plugin/issues/211">#211</a>:
Upgrade to use JRuby <a href="http://jruby.org/2015/09/02/jruby-9-0-1-0.html">9.0.1.0</a>
by default</p>
</li>
<li>
<p><a href="https://github.com/jruby-gradle/jruby-gradle-plugin/issues/193">#193</a>:
Avoid packing a redundant copy of
<a href="https://github.com/jruby/jruby-mains">jruby-mains</a> inside packed jars</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="bug-fixes"><a class="anchor" href="#bug-fixes"></a>Bug fixes</h2>
<div class="sectionbody">
<div class="ulist">
<ul>
<li>
<p><a href="https://github.com/jruby-gradle/jruby-gradle-plugin/issues/190">#190</a>: generated
gradle.rb needs to follow the jars/gems setup we have everywhere else</p>
</li>
<li>
<p><a href="https://github.com/jruby-gradle/jruby-gradle-plugin/issues/213">#213</a>:
cannot resolve gems with <code>~&gt; 0.10.4.0</code> to <code>0.10.4</code> the way bundler does</p>
</li>
<li>
<p><a href="https://github.com/jruby-gradle/jruby-gradle-storm-plugin/issues/21">jruby-gradle-storm-plugin#21</a>:
enable easier subclassing of <code>JRubyJar</code> so subclasses can override
properties cleanly.</p>
</li>
<li>
<p><a href="https://github.com/jruby-gradle/jruby-gradle-plugin/issues/220">#220</a>:
prepareJRubyJar doesn&#8217;t cache results and reinstalls gems every single run</p>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<div class='post'>
<h1>
<a href='/news/2015/09/01/gradle-spotlight-continuous-build/'>Gradle Feature Spotlight: Continuous Build</a>
</h1>
<strong>
01 September 2015
</strong>
<div class='content'>
<div class="paragraph">
<p>Earlier this year the <a href="http://gradle.org">Gradle</a> project released version
<a href="https://docs.gradle.org/2.5/release-notes">2.5</a> with a heap of new features
and improvements. One of the most touted of those features is an incubating
feature (read: beta) named
<a href="https://docs.gradle.org/current/userguide/continuous_build.html">Continuous
Build</a> which automatically re-executes tasks after a file change. Rubyists may
recognize that this functionality is similar to what
<a href="http://guardgem.org/">the guard gem</a> provides.</p>
</div>
<div class="paragraph">
<p>What makes "continuous build" special is that it makes use of the <em>existing</em>
build data present in your Gradle build. Using a
<a href="https://docs.gradle.org/current/userguide/more_about_tasks.html#sec:task_inputs_outputs">task&#8217;s
inputs</a> the continuous build feature can automatically "watch" the appropriate
files to re-execute your task, or your tasks dependent tasks, automatically as
they change!</p>
</div>
<div class="paragraph">
<p>For users JRuby/Gradle this means that upgrading to Gradle 2.5 or later, and
ensuring your <code>build.gradle</code> declares task inputs and continuous build will
"just work!" Consider the following example for running
<a href="http://rspec.info">RSpec</a> tests:</p>
</div>
<div class="listingblock">
<div class="title">build.gradle</div>
<div class="content">
<pre class="CodeRay highlight nowrap"><code data-lang="gradle">buildscript {
repositories { jcenter() }
dependencies {
classpath &quot;com.github.jruby-gradle:jruby-gradle-plugin:1.0.3&quot; <i class="conum" data-value="1"></i><b>(1)</b>
}
}
apply plugin: 'com.github.jruby-gradle.base' <i class="conum" data-value="2"></i><b>(2)</b>
dependencies {
jrubyExec 'rubygems:rspec:3.3.0' <i class="conum" data-value="3"></i><b>(3)</b>
}
import com.github.jrubygradle.JRubyExec
task spec(type: JRubyExec) {
group 'JRuby'
description 'Execute the RSpecs in JRuby'
script 'rspec'
inputs.source fileTree('spec').include('**/*.rb'), fileTree('lib').include('**/*.rb') <i class="conum" data-value="4"></i><b>(4)</b>
}</code></pre>
</div>
</div>
<div class="colist arabic">
<table>
<tr>
<td><i class="conum" data-value="1"></i><b>1</b></td>
<td>Specify our dependency on the JRuby/Gradle <a href="/base/">base plugin</a></td>
</tr>
<tr>
<td><i class="conum" data-value="2"></i><b>2</b></td>
<td>Apply the plugin to our current project</td>
</tr>
<tr>
<td><i class="conum" data-value="3"></i><b>3</b></td>
<td>Define our RSpec gem dependency</td>
</tr>
<tr>
<td><i class="conum" data-value="4"></i><b>4</b></td>
<td>Set our task inputs to the <code>.rb</code> files in <code>spec/</code> and in <code>lib/</code></td>
</tr>
</table>
</div>
<div class="paragraph">
<p>Using the <code>build.gradle</code> above, I can auto-execute my tests whenever a Ruby file
inside of the <code>spec/</code> (my tests) or <code>lib/</code> (my code under test) with the
following command:</p>
</div>
<div class="literalblock">
<div class="content">
<pre class="nowrap">% ./gradlew -t spec</pre>
</div>
</div>
<div class="paragraph">
<p>Here&#8217;s some example output from my example project:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="nowrap">example-project git:(master) % ./gradlew -t spec
Continuous build is an incubating feature.
:spec
Randomized with seed 37453
..............................................
Finished in 0.52 seconds (files took 3.82 seconds to load)
46 examples, 0 failures
Randomized with seed 37453
BUILD SUCCESSFUL
Total time: 8.77 secs
Waiting for changes to input files of tasks... (ctrl-d to exit)</pre>
</div>
</div>
<div class="paragraph">
<p>At this point the Gradle process is patiently waiting until I write my most
recent changes, then it kicks off the same task:</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="nowrap">Change detected, executing build...
:spec
Randomized with seed 64935
..............................................
Finished in 0.502 seconds (files took 3.5 seconds to load)
46 examples, 0 failures
Randomized with seed 64935
BUILD SUCCESSFUL
Total time: 7.341 secs
Waiting for changes to input files of tasks... (ctrl-d to exit)</pre>
</div>
</div>
<div class="paragraph">
<p>Pretty neat huh?</p>
</div>
<div class="paragraph">
<p>What makes this functionality exceptionally powerful for JRuby/Gradle users is
that it respects the task inputs but also the task dependency graph. If my <code>spec</code>
task declares a dependency on the <code>compileJava</code> task, whenever my Java source
code changes, that will trigger a re-execution of <code>compileJava</code> and in turn
<code>spec</code>!</p>
</div>
<div class="paragraph">
<p>So when you&#8217;re authoring tasks, even if you&#8217;re not this feature right now, be
sure to declare task inputs. That build metadata can unlock lots of interesting
functionality as Gradle continues to improve!</p>
</div>
<div class="paragraph">
<p>Continuous build is one of many examples of powerful Gradle functionality which
can easily used in JRuby/Gradle, I hope you find it useful!</p>
</div>
</div>
</div>
<div class='post'>
<h1>
<a href='/news/2015/08/16/introduction-at-jrubyconfeu/'>JRuby/Gradle at JRubyConf EU 2015</a>
</h1>
<strong>
16 August 2015
</strong>
<div class='content'>
<div class="paragraph">
<p>A couple weeks ago, <a href="https://github.com/ysb33r">Schalk</a>,
<a href="https://github.com/mkristian">Christian</a> and
<a href="https://github.com/rtyler">I</a> were fortunate enough to participate in the
wonderful <a href="http://2015.jrubyconf.eu">JRubyConf EU 2015</a> in Potsdam Germany.
In the days that preceeded the conference we pulled together and finished up
what would become the <a href="/news/2015/08/04/jrubygradle-one-point-oh/">1.0
release</a> of the core plugins. Just in time for my presentation to introduce the
JRuby/Gradle toolchain to the audience.</p>
</div>
<div class="paragraph">
<p>Below is a video recoded by <a href="http://confreaks.tv">Confreaks.tv</a> of the talk
titled <strong>JRuby/Gradle: Bringing Java Powertools to Ruby</strong>:</p>
</div>
<center><iframe width="560" height="315" src="https://www.youtube.com/embed/kZt6Ga20lD0" frameborder="0" allowfullscreen></iframe></center>
<div class="paragraph">
<p>The <a href="http://confreaks.tv/events/jrubyconf2015">other sessions</a> are also
worth checking out as there was a lot of great, in-depth, technical content
presented at the single-track one-day conference.</p>
</div>
<div class="paragraph">
<p>On behalf of the
<a href="https://www.flickr.com/photos/agentdero/20372579815/">JRuby/Gradle core
team</a>, I&#8217;d like to thank the conference organizers (especially
<a href="https://github.com/pragtob">Tobi</a>) for hosting such a wonderful event and
allowing us the opportunity to participate. Hopefully we&#8217;ll be back next year
with more to talk about!</p>
</div>
</div>
</div>
<div class='post'>
<h1>
<a href='/news/2015/08/04/jrubygradle-one-point-oh/'>JRuby/Gradle 1.0 Announced</a>
</h1>
<strong>
04 August 2015
</strong>
<div class='content'>
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>Less than one year after the <a href="http://github.com/jruby-gradle">JRuby/Gradle</a>
project was founded, we are pleased to announce the release of <strong>1.0</strong> for the
core plugins, which includes <a href="/base/">the base plugin</a>, <a href="/jar/">the jar
plugin</a> and an alpha version of the <a href="/war/">war plugin</a>. This release marks
the stability of the core task and configuration APIs for the lifetime of the
<code>1.x</code> branch of development.</p>
</div>
</div>
</div>
<div class="sect1">
<h2 id="notable-features"><a class="anchor" href="#notable-features"></a>Notable Features</h2>
<div class="sectionbody">
<div class="paragraph">
<p>This release includes a number of notable features which can help developers
build high quality Ruby projects, based on <a href="http://jruby.org">JRuby</a>.</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Defaulted to the major milestone release: <a href="jruby.org/2015/07/22/jruby-9-0-0-0.html">JRuby 9.0.0.0</a></p>
</li>
<li>
<p>Native Java dependency resolution via Gradle&#8217;s built-in support of Maven
repositories and with Gem dependency resolution via a
<a href="http://rubygems.org">rubygems.org</a> <a href="http://rubygems.lasagna.io/proxy/maven/releases">proxy</a>.</p>
</li>
<li>
<p>Execution of local Ruby script via the <a href="/base/#jrubyexec">JRubyExec task</a></p>
</li>
<li>
<p>Execution of scripts provided by a gem dependency, e.g. <code>rspec</code> via
<a href="/base/#jrubyexec">JRubyExec task</a></p>
</li>
<li>
<p>Support for distinct
<a href="https://docs.gradle.org/current/dsl/org.gradle.api.artifacts.Configuration.html">configurations</a>
to isolate dependencies, even JRuby versions, between <a href="/base/#jrubyexec">JRubyExec tasks</a>.</p>
</li>
<li>
<p>Similar support for different configurations between <a href="/jar/#jrubyjar">JRubyJar
tasks</a></p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="project-history"><a class="anchor" href="#project-history"></a>Project History</h2>
<div class="sectionbody">
<div class="paragraph">
<p>The JRuby/Gradle project was originally started to address the challenges faced
when attempting to build complex Ruby applications based on
<a href="http://jruby.org">JRuby</a>. With such applications it is desirable to leverage
the vast libraries available to JVM-based languages, as well as many of the
user-friendly gems built by Ruby developers</p>
</div>
<div class="paragraph">
<p>After trying to make multiple tools, which weren&#8217;t designed to support non-Java
projects, work with Ruby <a href="https://github.com/rtyler">R. Tyler Croy</a> started
building a prototype with Gradle to package up a JRuby application as a jar.
Shortly after publishing the prototype, <a href="https://github.com/ysb33r">Schalke
W. Cronje</a> discovered the fledgling project and with his Gradle development
experience helped bring it from a weekend hack project to a well-tested,
well-structured set of Gradle plugins. Eventually
<a href="https://github.com/mkristian">Christian Meier</a>, whose
link:https://github.com/torquebox/rubygems-servlets] code helped make the
project originally possible, joined the team to help improve support in JRuby
itself for the different embedded operating modes that the JRuby/Gradle
toolchain makes use of.</p>
</div>
</div>
</div>
</div>
</div>
</div>
<hr>
<div id='improve'>
<a href='https://github.com/jruby-gradle/jruby-gradle-plugin/edit/master/docs//news.html.haml'>
improve this page
</a>
</div>
</body>
</html>