Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoSuchMethodError Exception #311

Open
turmanticant opened this issue Jan 26, 2025 · 2 comments
Open

NoSuchMethodError Exception #311

turmanticant opened this issue Jan 26, 2025 · 2 comments

Comments

@turmanticant
Copy link

Hey! I am trying to incorporate copybara into a bazel modules project. When I add copybara (from the bazel central registry) to my project and run bazel run @copybara//java/com/google/copybara -- (pwd)/copy.bara.sky --force I get this exception. The copy.bara.sky file has the same contents of the example in README.md.

bazel run @copybara//java/com/google/copybara -- (pwd)/copy.bara.sky --force
INFO: Analyzed target @@copybara+//java/com/google/copybara:copybara (0 packages loaded, 0 targets configured).
INFO: Found 1 target...
Target @@copybara+//java/com/google/copybara:copybara up-to-date:
  bazel-bin/external/copybara+/java/com/google/copybara/copybara
  bazel-bin/external/copybara+/java/com/google/copybara/copybara.jar
INFO: Elapsed time: 0.082s, Critical Path: 0.01s
INFO: 1 process: 1 internal.
INFO: Build completed successfully, 1 total action
INFO: Running command line: bazel-bin/external/copybara+/java/com/google/copybara/copybara <args omitted>
Jan 25, 2025 10:38:38 PM com.google.copybara.Main configureLog
INFO: Setting up LogManager
Copybara source mover (Version: Unknown version)
Task: Git Origin: Initializing local repo
Exception in thread "main" java.lang.NoSuchMethodError: 'java.time.Duration com.google.common.base.Stopwatch.elapsed()'
        at com.google.copybara.util.CommandRunner.execute(CommandRunner.java:259)
        at com.google.copybara.git.GitRepository.executeGit(GitRepository.java:1723)
        at com.google.copybara.git.GitRepository.executeGit(GitRepository.java:1700)
        at com.google.copybara.git.GitRepository.git(GitRepository.java:1631)
        at com.google.copybara.git.GitRepository.init(GitRepository.java:1470)
        at com.google.copybara.git.GitOptions.initRepo(GitOptions.java:174)
        at com.google.copybara.git.GitOptions.createBareRepo(GitOptions.java:170)
        at com.google.copybara.git.GitOptions.cachedBareRepoForUrl(GitOptions.java:137)
        at com.google.copybara.git.GitOrigin.getRepository(GitOrigin.java:169)
        at com.google.copybara.git.GitOrigin.resolveStringRef(GitOrigin.java:271)
        at com.google.copybara.git.GitOrigin.resolve(GitOrigin.java:252)
        at com.google.copybara.git.GitOrigin.resolve(GitOrigin.java:66)
        at com.google.copybara.Workflow.lambda$run$0(Workflow.java:282)
        at com.google.copybara.GeneralOptions.repoTask(GeneralOptions.java:222)
        at com.google.copybara.Workflow.run(Workflow.java:281)
        at com.google.copybara.MigrateCmd.run(MigrateCmd.java:92)
        at com.google.copybara.MigrateCmd.run(MigrateCmd.java:69)
        at com.google.copybara.Main.runInternal(Main.java:246)
        at com.google.copybara.Main.run(Main.java:128)
        at com.google.copybara.Main.main(Main.java:106)
@chris-campos
Copy link
Contributor

Looking at https://registry.bazel.build/modules/copybara, the Bazel Central Repository version is quite old. We don't officially maintain this release and this was likely uploaded by a third-party contributor.

The current recommendation is to compile Copybara from source. Weekly releases are being worked on, tracked here: #310

@turmanticant
Copy link
Author

Thanks for the clarification! I should be able to use http_jar or archive_override to include it in my bazel workspace.

It would be convenient if y'all pushed to the bcr on release 😀

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

No branches or pull requests

2 participants