jbundler icon indicating copy to clipboard operation
jbundler copied to clipboard

Error running jbundle install: Errno::ENOENT: No such file or directory - pkg/dependencies.txt

Open jeremyhaile opened this issue 8 years ago • 15 comments

We are running into this error every time we run jbundle install using jbundler 0.9.3

Not sure why it started happening or where to begin fixing this. We also tried version 0.9.2 and it also happens. Here is the error and debug output:

bundle exec jbundle install --debug ... mvn dependency:list -f /Users/<user>/.rvm/gems/jruby-9.0.1.0@project/gems/jbundler-0.9.3/lib/jbundler/dependency_pom.rb -Dverbose=true -X -DexcludeTransitive=false -Djbundler.outputFile=/Users/<user>/projects/project/pkg/dependencies.txt -Djbundler.basedir=/Users/<user>/projects/project -Djbundler.jarfile=/Users/<user>/projects/project/Jarfile -Djbundler.gemfile=/Users/<user>/projects/project/Gemfile -Djbundler.workdir=/Users/<user>/projects/project/pkg -Djbundler.groups -Djbundler.bootstrap -Dmaven.repo.local=/Users/<user>/.m2/repository mvn dependency:list -f /Users/<user>/.rvm/gems/jruby-9.0.1.0@project/gems/jbundler-0.9.3/lib/jbundler/dependency_pom.rb -Dverbose=true -X -DexcludeTransitive=false -Djbundler.outputFile=/Users/<user>/projects/project/pkg/dependencies.txt -Djbundler.basedir=/Users/<user>/projects/project -Djbundler.jarfile=/Users/<user>/projects/project/Jarfile -Djbundler.gemfile=/Users/<user>/projects/project/Gemfile -Djbundler.workdir=/Users/<user>/projects/project/pkg -Djbundler.groups -Djbundler.bootstrap -Dmaven.repo.local=/Users/<user>/.m2/repository Errno::ENOENT: No such file or directory - /Users/<user>/projects/project/pkg/dependencies.txt read at org/jruby/RubyIO.java:3592 install_dependencies at /Users/<user>/.rvm/gems/jruby-9.0.1.0@project/gems/jbundler-0.9.3/lib/jbundler/lock_down.rb:113 lock_down at /Users/<user>/.rvm/gems/jruby-9.0.1.0@project/gems/jbundler-0.9.3/lib/jbundler/lock_down.rb:54 install at /Users/<user>/.rvm/gems/jruby-9.0.1.0@project/gems/jbundler-0.9.3/lib/jbundler/cli.rb:80 run at /Users/<user>/.rvm/gems/jruby-9.0.1.0@global/gems/bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/command.rb:27 invoke_command at /Users/<user>/.rvm/gems/jruby-9.0.1.0@global/gems/bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/invocation.rb:126 dispatch at /Users/<user>/.rvm/gems/jruby-9.0.1.0@global/gems/bundler-1.11.2/lib/bundler/vendor/thor/lib/thor.rb:359 start at /Users/<user>/.rvm/gems/jruby-9.0.1.0@global/gems/bundler-1.11.2/lib/bundler/vendor/thor/lib/thor/base.rb:440 <top> at /Users/<user>/.rvm/gems/jruby-9.0.1.0@project/gems/jbundler-0.9.3/bin/jbundle:47 load at org/jruby/RubyKernel.java:957 <top> at /Users/<user>/.rvm/gems/jruby-9.0.1.0@project/bin/jbundle:1

Here is our Jarfile:

repository :typesafe, "http://repo.typesafe.com/typesafe/releases/"

jar 'org.scala-lang:scala-library', '2.10.4'
jar 'com.typesafe.akka:akka-actor_2.10', '2.3.6'
jar 'com.typesafe.akka:akka-remote_2.10', '2.3.6'
jar 'com.typesafe.akka:akka-slf4j_2.10', '2.3.6'

jar 'org.apache.opennlp:opennlp-tools', '1.5.3'
jar 'org.apache.opennlp:opennlp-maxent', '3.0.3'

jar 'com.github.rholder:snowball-stemmer', '1.3.0.581.1'

jar 'com.ning:async-http-client', '1.9.34'
jar 'io.netty:netty', '3.10.5.Final'

jar 'ch.qos.logback:logback-classic', '1.1.2'

jeremyhaile avatar May 23 '16 15:05 jeremyhaile

hmm, does not look like maven gets executed at all - at least I do not see the expected maven debug log.

could you try to execute

lock_jars which does also lock down the Jarfile and jbundler is using it under the hood.

will make some time for it tomorrow.

mkristian avatar May 23 '16 19:05 mkristian

@mkristian sorry for the double filing of this issue. Github was acting up this morning and wasn't showing that it had created successfully. I'll close the duplicate issue.

jeremyhaile avatar May 23 '16 19:05 jeremyhaile

thanks, I do fight with no responsive pages as well from time to time, vpn has hickups or github or system starts swapping . . . :)

mkristian avatar May 23 '16 19:05 mkristian

@mkristian BTW - it doesn't look like the command you wanted me to run pasted correctly. Please see your previous comment.

jeremyhaile avatar May 23 '16 19:05 jeremyhaile

lock_jars

mkristian avatar May 23 '16 20:05 mkristian

and the last one was empty again :( bummer. it was lock_jars

mkristian avatar Jun 10 '16 07:06 mkristian

Same problem here.

What is lock_jars from?

edit: to answer my own question, it's from the jar-dependencies gem, though wasn't runnable via bundle exec for me.

xxx avatar Aug 01 '16 21:08 xxx

@xxx jar-dependencies is default gem maybe jruby is still doing something wrong with its default gems and their executables. just add jar-dependencies to your bundle and bundler should be able to execute its executables.

mkristian avatar Aug 02 '16 07:08 mkristian

Had a similar problem, but after running lock_jars (after setting up the bundle) ended up getting: Exception in thread "main" java.lang.UnsupportedClassVersionError: org/apache/maven/cli/MavenCli : Unsupported major.minor version 51.0 Which pointed me to this

My env was using java6, once I flipped it over to java 8:

export JAVA_HOME=`/usr/libexec/java_home -v 1.8`

on Mac OS X El Capitan (assuming you have java 8 installed as well) I was able to jbundle install successfully. Not sure if this will solve your issue, but figured I'd throw it out there.

lampad avatar Aug 12 '16 21:08 lampad

We are facing this issue, and do not have any resolution for it. We haven't changed any dependencies in our project and this error popped all of a sudden. The debug logs also do not show any other logs other than the error. @mkristian

punit-kulal avatar Feb 22 '22 07:02 punit-kulal

This issue was caused by a recent update to ruby-maven 3.3.13

punit-kulal avatar Feb 22 '22 11:02 punit-kulal

@punit-kulal any chance you could provide a small sample project where I can reproduce the error, that would be very helpful. missing pkg/dependencies.txt that the maven run failed.

mkristian avatar Feb 22 '22 11:02 mkristian

I had the same issue and the downgrade of ruby-maven to 3.3.12 fixed it for me. I’ve created a small Dockerfile to reproduce it.

FROM jruby:9.3.6.0
WORKDIR /test
RUN gem install ruby-maven -v 3.3.12 # Comment this line out to make it fail.
RUN gem install jbundler
RUN echo "jar 'org.yaml:snakeyaml', '1.14'" > Jarfile
RUN jbundle

As it is, the dockerfile will succeed, however when commenting out the line that installs a non-3.3.13 version of ruby-maven, it will fail with the following error:

Errno::ENOENT: No such file or directory - /test/pkg/dependencies.txt
               sysopen at org/jruby/RubyIO.java:1227
                  read at org/jruby/RubyIO.java:3986
  install_dependencies at /usr/local/bundle/gems/jbundler-0.9.4/lib/jbundler/lock_down.rb:113
             lock_down at /usr/local/bundle/gems/jbundler-0.9.4/lib/jbundler/lock_down.rb:54
               install at /usr/local/bundle/gems/jbundler-0.9.4/lib/jbundler/cli.rb:80
                   run at /opt/jruby/lib/ruby/gems/shared/gems/bundler-2.3.17/lib/bundler/vendor/thor/lib/thor/command.rb:27
        invoke_command at /opt/jruby/lib/ruby/gems/shared/gems/bundler-2.3.17/lib/bundler/vendor/thor/lib/thor/invocation.rb:127
              dispatch at /opt/jruby/lib/ruby/gems/shared/gems/bundler-2.3.17/lib/bundler/vendor/thor/lib/thor.rb:392
                 start at /opt/jruby/lib/ruby/gems/shared/gems/bundler-2.3.17/lib/bundler/vendor/thor/lib/thor/base.rb:485
                <main> at /usr/local/bundle/gems/jbundler-0.9.4/bin/jbundle:47
                  load at org/jruby/RubyKernel.java:1052
                <main> at /usr/local/bundle/bin/jbundle:25

Even though this clearly makes ruby-maven responsible for the issue, jbundler does not seem to have proper error handling for it. I’m new to jbundler, so for the sake of a minimal reproducable example I tried omitting the version info from the Jarfile (i.e. just jar 'org.yaml:snakeyaml'), and got a proper error, but also the same error as above:

[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.yaml:snakeyaml:jar -> version 1.28 vs (?) @ 
[ERROR] 'dependencies.dependency.version' for org.yaml:snakeyaml:jar is missing. @ 
 @ 
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]   
[ERROR]   The project no_group_id_given:jbundler:0.0.0 (/usr/local/bundle/gems/jbundler-0.9.4/lib/jbundler/dependency_pom.rb) has 1 error
[ERROR]     'dependencies.dependency.version' for org.yaml:snakeyaml:jar is missing.
[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/ProjectBuildingException
Errno::ENOENT: No such file or directory - /test/pkg/dependencies.txt
               sysopen at org/jruby/RubyIO.java:1227
...

expeehaa avatar Jul 06 '22 18:07 expeehaa

thanks this was very helpful, I 'found the regression happens between io.takari.polyglot:polyglot-ruby:0.4.4 and io.takari.polyglot:polyglot-ruby:0.4.5

mkristian avatar Jul 13 '22 20:07 mkristian

I ran into this today as well. The recent version of this problem seems to be down to this change https://github.com/takari/polyglot-maven/pull/221

In https://github.com/takari/polyglot-maven/blob/polyglot-0.4.9/polyglot-common/src/main/java/org/sonatype/maven/polyglot/TeslaModelProcessor.java#L161-L172 when maven is executed with the argument of lib/jbundler/dependency_pom.rb, this doesn't match the default pom names it instead searches the parent directory for a pom and settles on lib/jbundler/pom.rb. The easiest fix for me seemed to be to isolate dependency_pom.rb in its own directory.

pcarlisle avatar Oct 19 '22 00:10 pcarlisle