Coder Social home page Coder Social logo

jruby9-maven-plugins's Introduction

jruby maven plugins and extensions

the plugins and extensions are modeled after jruby-gradle and uses the old jruby maven plugins under the hood but it needs jruby-1.7.19 or newer (including jruby-9.0.0.0 serie).

even though the plugin depends on the old jruby-maven-plugins it has a different version.

general command line switches

to see the java/jruby command the plugin is using (for example with the verify goal)

mvn verify -Djruby.verbose

to quickly pick another jruby version use

mvn verify -Djruby.version=1.7.20

jruby9-exec-maven-plugin

it install the gems and jars from ALL scopes and the plugin sections and can execute ruby. execution can be

  • inline ruby: -e 'puts JRUBY_VERSION'
  • via command installed via a gem: -S rake -T
  • a ruby script: my.rb

see more at jruby9-exec-maven-plugin

jruby9-jar-maven-plugin

it packs all gems and jars from the compile/runtime as well the declared resources into runnable jar. execution will with packed jar

  • inline ruby: java -jar my.jar -e 'puts JRUBY_VERSION'
  • via command installed via a gem: java -jar my.jar -S rake -T
  • a ruby script: java -jar my.jar my.rb

see more at jruby9-jar-maven-plugin

jruby9-jar-extension

it produces the same jar as with jruby9-jar-plugin but the configuration is more compact using a maven extension.

see more at jruby9-extensions

meta-fu

create an issue if something feels not right

issues/new

otherwise enjoy :)

jruby9-maven-plugins's People

Contributors

mkristian avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

jruby9-maven-plugins's Issues

jruby9-exec-maven-plugin can no longer bundle install

I have the following pom file:

<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>gov.va.api.wss.reference.data.service.prototype</groupId>
  <artifactId>evss_prototype</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>pom</packaging>

  <name>evss jruby prototype</name>

  <description>
    This project wss-reference-data-service api.
  </description>

  <properties>
  </properties>

  <organization>
    <name>Department of Veterans Affairs</name>
    <url>http://www.va.gov/</url>
  </organization>

  <repositories>
    <repository>
      <id>mavengems</id>
      <url>mavengem:https://rubygems.org</url>
      <snapshots>
        <enabled>false</enabled>
      </snapshots>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>mavengems</id>
      <url>mavengem:https://rubygems.org</url>
    </pluginRepository>
  </pluginRepositories>

  <dependencies>
    <dependency>
      <groupId>org.jruby</groupId>
      <artifactId>jruby-complete</artifactId>
      <version>9.3.0.0</version>
    </dependency>
    <dependency>
      <groupId>rubygems</groupId>
      <artifactId>rake</artifactId>
      <version>13.0.6</version>
      <type>gem</type>
    </dependency>
    <dependency>
      <groupId>rubygems</groupId>
      <artifactId>bundler</artifactId>
      <version>2.2.24</version>
      <type>gem</type>
    </dependency>
  </dependencies>

  <build>

    <extensions>
      <extension>
        <groupId>org.torquebox.mojo</groupId>
        <artifactId>mavengem-wagon</artifactId>
        <version>1.0.3</version>
      </extension>
    </extensions>

    <plugins>

      <plugin>
        <groupId>org.torquebox.mojo</groupId>
        <artifactId>jruby9-exec-maven-plugin</artifactId>
        <version>0.3.1</version>
        <executions>
          <execution>
            <id>install bundler</id>
            <phase>compile</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <jrubyVerbose>true</jrubyVerbose>
              <jrubyJvmArgs>-Xmx4000m -Djava.awt.headless=true</jrubyJvmArgs>
              <command>gem</command>
              <args>install bundler</args>
            </configuration>
          </execution>
    </plugins>
  </build>
</project>

The following execution fails:

          <execution>
            <id>install bundler</id>
            <phase>compile</phase>
            <goals>
              <goal>exec</goal>
            </goals>
            <configuration>
              <jrubyVerbose>true</jrubyVerbose>
              <jrubyJvmArgs>-Xmx4000m -Djava.awt.headless=true</jrubyJvmArgs>
              <command>gem</command>
              <args>install bundler</args>
            </configuration>
          </execution>

As follows:

[INFO] Execute:Java13CommandLauncher: Executing '/usr/local/openjdk-8/bin/java' with arguments:
'-cp'
'/root/.m2/repository/org/jruby/jruby-complete/9.3.0.0/jruby-complete-9.3.0.0.jar'
'-Xmx4000m'
'-Djava.awt.headless=true'
'-Xbootclasspath/a:/root/.m2/repository/org/jruby/jruby-complete/9.3.0.0/jruby-complete-9.3.0.0.jar'
'org.jruby.Main'
'-I'
'/srv/wss-reference-data-service/src/lib'
'-e'
'load('jar:file:/root/.m2/repository/org/jruby/jruby-complete/9.3.0.0/jruby-complete-9.3.0.0.jar!/META-INF/jruby.home/bin/gem')'
'--'
'install'
'--ignore-dependencies'
'--no-rdoc'
'--no-ri'
'--no-user-install'
'--no-verbose'
'/root/.m2/repository/rubygems/rake/13.0.6/rake-13.0.6.gem'
'/root/.m2/repository/rubygems/bundler/2.2.24/bundler-2.2.24.gem'
'--bindir'
'/srv/wss-reference-data-service/src/target/rubygems/bin'

The ' characters around the executable and arguments are
not part of the command.
[INFO] ERROR:  While executing gem ... (OptionParser::InvalidOption)
[INFO]     invalid option: --no-rdoc
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  13.711 s
[INFO] Finished at: 2021-10-01T20:01:41Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.torquebox.mojo:jruby9-exec-maven-plugin:0.3.1:exec (install bundler) on project evss_prototype: Execution install bundler of goal org.torquebox.
mojo:jruby9-exec-maven-plugin:0.3.1:exec failed: Java returned: 1 -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.torquebox.mojo:jruby9-exec-maven-plugin:0.3.1:exec (install bundler) on project evss_prototype:
Execution install bundler of goal org.torquebox.mojo:jruby9-exec-maven-plugin:0.3.1:exec failed: Java returned: 1

We can see here:
puphpet/puphpet#2838

That for newer gems

'--no-rdoc'
'--no-ri'

is no longer supported. I cannot find how to suppress these flags.

Thanks.

rspecs not executed under windows

When using the jrubyExecExample and commenting out all executions except the rspec one I get:

[INFO] Finished in 0.006 seconds (files took 0.323 seconds to load)
[INFO] 0 examples, 0 failures

The one_specs.rb is not executed

When running rspec in the example folder:

rspec
.

Finished in 0.001 seconds (files took 0.20602 seconds to load)
1 example, 0 failures

cant set -Xmx properly

Trying to set the memory limits via -Xmx4G, and finding that I can't, because it is always putting in its own value (why would this be hardcoded?)

[INFO] Execute:Java13CommandLauncher: Executing '/opt/java/jdk_x64_1.8.0_65/jre/bin/java' with arguments:
'-cp'
''
'-cp'
'/mnt/STORAGE/repository/org/jruby/jruby-complete/9.0.4.0/jruby-complete-9.0.4.0.jar'
'-Xmx384m'
'-Xmx4G'

where did the 384m come from?

The plugin shouldn't specify any max at all by default, just let the JVM select... it will do a much better job than 384m.

Bundle install not working on windows

I am trying to upgrade JRuby...

Much to my dismay, once you upgrade to 9.1.9 (9.1.8 works) the build fails. So, from my maven build, I have:

<dependency>
   <groupId>org.jruby</groupId>
   <artifactId>jruby-complete</artifactId>
   <version>9.1.12.0</version>
</dependency>

And I have:

<plugin>
   <groupId>org.torquebox.mojo</groupId>
   <artifactId>jruby9-exec-maven-plugin</artifactId>
   <version>0.3.1</version>
   <executions>
      <execution>
         <id>bundle install</id>
         <phase>compile</phase>
         <goals>
            <goal>exec</goal>
         </goals>
         <configuration>
            <jrubyVerbose>true</jrubyVerbose>
            <jrubyJvmArgs>-Xmx4000m -Djava.awt.headless=true</jrubyJvmArgs>
            <command>bundle</command>
            <args>install</args>
         </configuration>
      </execution>

If I set JRuby to 9.1.8 in the maven build, the bundle install works. It generates the following:

[INFO] Execute:Java13CommandLauncher: Executing 'C:\languages\Java\jdk1.8.0_65\jre\bin\java.exe' with arguments:
'-cp'
'C:\Users\cshupp\.m2\repository\org\jruby\jruby-complete\9.1.8.0\jruby-complete-9.1.8.0.jar'
'-Xmx4000m'
'-Djava.awt.headless=true'
'-Xbootclasspath/a:C:\Users\cshupp\.m2\repository\org\jruby\jruby-complete\9.1.8.0\jruby-complete-9.1.8.0.jar'
'org.jruby.Main'
'-I'
'C:\work\va-ctt\rails\rails_komet\lib'
'-r'
'jars/setup'
'C:\work\va-ctt\rails\rails_komet\target\rubygems\bin\bundle'
'install'

With 9.1.9 and above it generates:

[INFO] Execute:Java13CommandLauncher: Executing 'C:\languages\Java\jdk1.8.0_65\jre\bin\java.exe' with arguments:
'-cp'
'C:\Users\cshupp\.m2\repository\org\jruby\jruby-complete\9.1.12.0\jruby-complete-9.1.12.0.jar'
'-Xmx4000m'
'-Djava.awt.headless=true'
'-Xbootclasspath/a:C:\Users\cshupp\.m2\repository\org\jruby\jruby-complete\9.1.12.0\jruby-complete-9.1.12.0.jar'
'org.jruby.Main'
'-I'
'C:\work\va-ctt\rails\rails_komet\lib'
'-e'
'require 'jruby/commands'; JRuby::Commands.generate_dir_info 'C:\work\va-ctt\rails\rails_komet\target\rubygems' if JRuby::Commands.respond_to? :generate_dir_info'
'--'

And the build fails. The failure happens on windows only. Any ideas?

Thanks,

Cris

not working on windows - cannot find main class

I successfully used the jruby9-exec-maven-plugin to do a rails build within maven when running on Linux.

However, when I run the same maven project on windows, it fails with:

[INFO] --- jruby9-exec-maven-plugin:0.2.2:exec (bundle install) @ ets_tooling ---
[INFO] jruby version   : 9.0.4.0
[INFO] script uses jruby jar:E:\Maven\Repository\org\jruby\jruby-complete\9.0.4.0\jruby-complete-9.0.4.0.jar
[INFO] add to ruby loadpath: E:\EclipseWorkspaces\ISAAC2\ets_tooling\lib
[INFO] installing gems for compile scope . . .
[INFO] java classpath  :
[INFO] environment     :
[INFO]          JARS_SKIP => true
[INFO]          GEM_PATH => E:\EclipseWorkspaces\ISAAC2\ets_tooling\target\rubygems
[INFO]          GEM_HOME => E:\EclipseWorkspaces\ISAAC2\ets_tooling\target\rubygems
[INFO]          JBUNDLE_SKIP => true
[INFO] Executing 'C:\Program Files\Java\jdk1.8.0_45\jre\bin\java.exe' with arguments:
'-cp'
''
'-cp'
'E:\Maven\Repository\org\jruby\jruby-complete\9.0.4.0\jruby-complete-9.0.4.0.jar'
'-Xmx384m'
'-Xbootclasspath/a:E:\Maven\Repository\org\jruby\jruby-complete\9.0.4.0\jruby-complete-9.0.4.0.jar'
'org.jruby.Main'
'-I'
'E:\EclipseWorkspaces\ISAAC2\ets_tooling\lib'
'-e'
'load('jar:file:E:\Maven\Repository\org\jruby\jruby-complete\9.0.4.0\jruby-complete-9.0.4.0.jar!/META-INF/jruby.home/bin/gem')'
'--'
'install'
'--ignore-dependencies'
'--no-rdoc'
'--no-ri'
'--no-user-install'
'--no-verbose'
'E:\Maven\Repository\rubygems\rake\10.4.2\rake-10.4.2.gem'
'E:\Maven\Repository\rubygems\bundler\1.11.2\bundler-1.11.2.gem'
'--bindir'
'E:\EclipseWorkspaces\ISAAC2\ets_tooling\target\rubygems\bin'

The ' characters around the executable and arguments are
not part of the command.
[INFO] Adding reference: ant.PropertyHelper
[INFO] Project base dir set to: E:\EclipseWorkspaces\ISAAC2\ets_tooling
[INFO] Setting environment variable: JARS_SKIP=true
[INFO] Setting environment variable: GEM_PATH=E:\EclipseWorkspaces\ISAAC2\ets_tooling\target\rubygems
[INFO] Setting environment variable: GEM_HOME=E:\EclipseWorkspaces\ISAAC2\ets_tooling\target\rubygems
[INFO] Setting environment variable: JBUNDLE_SKIP=true
[INFO] Execute:Java13CommandLauncher: Executing 'C:\Program Files\Java\jdk1.8.0_45\jre\bin\java.exe' with arguments:
'-cp'
''
'-cp'
'E:\Maven\Repository\org\jruby\jruby-complete\9.0.4.0\jruby-complete-9.0.4.0.jar'
'-Xmx384m'
'-Xbootclasspath/a:E:\Maven\Repository\org\jruby\jruby-complete\9.0.4.0\jruby-complete-9.0.4.0.jar'
'org.jruby.Main'
'-I'
'E:\EclipseWorkspaces\ISAAC2\ets_tooling\lib'
'-e'
'load('jar:file:E:\Maven\Repository\org\jruby\jruby-complete\9.0.4.0\jruby-complete-9.0.4.0.jar!/META-INF/jruby.home/bin/gem')'
'--'
'install'
'--ignore-dependencies'
'--no-rdoc'
'--no-ri'
'--no-user-install'
'--no-verbose'
'E:\Maven\Repository\rubygems\rake\10.4.2\rake-10.4.2.gem'
'E:\Maven\Repository\rubygems\bundler\1.11.2\bundler-1.11.2.gem'
'--bindir'
'E:\EclipseWorkspaces\ISAAC2\ets_tooling\target\rubygems\bin'

The ' characters around the executable and arguments are
not part of the command.
[INFO] Error: Could not find or load main class E:\Maven\Repository\org\jruby\jruby-complete\9.0.4.0\jruby-complete-9.0.4.0.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.861 s
[INFO] Finished at: 2016-03-03T11:06:13-06:00
[INFO] Final Memory: 18M/376M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal de.saumya.mojo:jruby9-exec-maven-plugin:0.2.2:exec (bundle install) on project ets_tooling: Execution bundle install of goal de.saumya.mojo:jruby9-exec-maven-plugin:0.2.2:exec failed: Java returned: 1 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

Not sure why this is failing on windows - I'm not spotting the problem in the output so far.

My configuration that works on linux, and fails on windows is here:
https://github.com/VA-CTT/ets_tooling/blob/22f91b1fdd7c3911020d95a12bd9230ff74c67a8/pom.xml

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.