Install maven package from gem install?

I remember awhile ago, there was an option to install maven packages via
gem.

with jruby 1.6.4, i’m trying:
jgem install mvn:org.slf4j.slf4j-log4j12

but i get this error:

ERROR: Could not find a valid gem ‘mvn:org.slf4j.slf4j-log4j12’ (>= 0)
in
any repository

Also, can bundler support specifying mvn packages as gems?

Thanks

can you try

jgem install mvn:org.slf4j:slf4j-log4j12

i.e. general format is

mvn::

  • Kristian

great that works. putting it in the bundler works as well.

There’s a lot of code snippets on the net that are outdated/misleading:

"

then after applying the patch on jruby master you should be able to do
something like:
$ gem install org.slf4j.slf4j-log4j12
"
http://jira.codehaus.org/browse/JRUBY-5102

This is cool, didn’t know you could do this. How would I reference a
package that is installed in my local repo but not any remote maven
repos?
Will this command use a pom.xml if it is in the root of the project?

On Wed, Oct 12, 2011 at 6:20 PM, Eric F. [email protected]
wrote:

This is cool, didn’t know you could do this. How would I reference a
package that is installed in my local repo but not any remote maven repos?

nope - let’s call it a bug or missing feature :wink:

Will this command use a pom.xml if it is in the root of the project?

not the jgem or jruby -S gem command. but if you have already a
pom.xml maybe the gemify-maven-plugin
(https://github.com/torquebox/jruby-maven-pluginstree/master/gemify-maven-plugin
and have a look at the integration tests in src/it to get an idea what
is possible) might help or even any of the other jruby-maven-plugins.
not sure what exactly you want to do !

  • Kristian

source does not work since all maven-gems are bound to an abstract
source ‘maven’ (or so).

but you can configure a maven repository in $HOME/.gemrc

please look at
http://blog.mkristian.tk/2011/03/rubygems-maven-support.html
for details how to do this.

  • Kristian

Is this feature able to install from any maven repo?

Do does the maven owner have to do something special?

I’m trying to install from a public nexus repo but failing:

$jruby -S gem install mvn:org.sweble.wikitext:swc-engine --source
http://mojo.informatik.uni-erlangen.de/nexus/content/repositories/public/
ERROR: Could not find a valid gem ‘mvn:org.sweble.wikitext:swc-engine’
(>=
0) in any repository
ERROR: While executing gem … (Gem::RemoteFetcher::FetchError)
bad response Not Found 404 (
http://mojo.informatik.uni-erlangen.de/nexus/content/repositories/public/latest_specs.4.8.gz
)

I tried following the blog post but still hitting a missing gem error:

ruby-maven (3.0.3.0.28.5) is installed

→$cat ~/.gemrc
maven:
plugin_version: 0.28.5
repositories:
http://mojo.informatik.uni-erlangen.de/nexus/content/repositories/public
settings: settings.xml

→$jruby -S gem install mvn:org.sweble.wikitext:swc-engine
ERROR: Could not find a valid gem ‘mvn:org.sweble.wikitext:swc-engine’
(>=
0) in any repository

this jruby feature uses gemify-maven-plugin under the hood, so I tried
this instead

rmvn gemify –
-Dgemify.repositories=http://mojo.informatik.uni-erlangen.de/nexus/content/repositories/public
-Dgemify.gemname=mvn:org.sweble.wikitext:swc-engine

but had some problems with the xstream
[ERROR] [ERROR] Failed to determine Java version for profile jdk15 @
line 124, column 14
[ERROR] [ERROR] Failed to determine Java version for profile jdk16 @
line 202, column 14
[ERROR] [ERROR] Failed to determine Java version for profile jdk14 @
line 279, column 14
[ERROR] for project com.thoughtworks.xstream:xstream:1.2.2

that is a bug - but do not know where in the plugin or in maven. the
jruby -S gem thingy is still silently ignoring the errors and moves on
as if it were a regular gem. did you by any chance update rubygems
which also wipes out the maven-gem support ?

right now I do not know how to solve this nicely BUT I hacked
something (a one liner) and deployed a snapshot of those plugin:
0.28.6-SNAPSHOT

please add the sonatype-snapshot plugin-repository as described in
http://blog.mkristian.tk/2011/03/rubygems-maven-support.html, unless
your nexus installation odes include that one already.

let me know if you get stuck again since quite often things work for
me but not for others (due to what I have in my local repository)

BTW
$ jruby -S gem install mvn:org.sweble.wikitext:swc-engine --debug
shows you some more info about what is going on.

regards,
Kristian

My errors are:

→$jruby -S gem install mvn:org.sweble.wikitext:swc-engine --debug
Exception LoadError' at org/jruby/RubyKernel.java:1038 - no such file to load -- psych ExceptionGem::LoadError’ at
/Users/t/.rvm/rubies/jruby-1.6.4/lib/ruby/site_ruby/1.8/rubygems.rb:861

RubyGem version error: sources(0.0.1 not > 0.0.1)

Using Maven install at /usr/local/maven/bin
maven find dependency failed for mvn:org.sweble.wikitext:swc-engine (>=
0,
runtime): undefined local variable or method usr_settings_file' for #<Gem::Maven::Gemify:0x24753433> ExceptionGem::GemNotFoundException’ at
/Users/t/.rvm/rubies/jruby-1.6.4/lib/ruby/site_ruby/1.8/rubygems/dependency_installer.rb:221

  • Could not find a valid gem ‘mvn:org.sweble.wikitext:swc-engine’ (>= 0)
    locally or in a repository
    ERROR: Could not find a valid gem ‘mvn:org.sweble.wikitext:swc-engine’
    (>=
  1. in any repository
    Exception `Gem::SystemExitException’ at
    /Users/t/.rvm/rubies/jruby-1.6.4/lib/ruby/site_ruby/1.8/rubygems/commands/install_command.rb:160
  • Exiting RubyGems with exit_code 2

hups

On Sat, Oct 15, 2011 at 10:41 AM, Tommy C. [email protected]
wrote:

usr_settings_file

that is broken in jruby. just find the location within your jruby
installation

find -name maven_gemify.rb | xargs grep settings_file

and change it to user_settings_file

I will create a pull request in the meanwhile

  • Kristian

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs