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

maven-bloop can't resolve the 2-depth dependency with "system scope" #27

Open
jsngbin opened this issue Jan 2, 2022 · 3 comments
Open

Comments

@jsngbin
Copy link

jsngbin commented Jan 2, 2022

Hello.

I found that maven-bloop can't resolve the dependency with "system scope" in specific case.

First, I add dependency like below within my project's pom.xml and it works fine.

<dependency>
      <groupId>jdk.tools</groupId>
      <artifactId>jdk.tools</artifactId>
      <version>1.8</version>
      <scope>system</scope>
      <systemPath>${java.home}/../lib/tools.jar</systemPath>
    </dependency> 

But, when I add the "hadoop-annotations" as a dependency like below (without dependency jdk.tools 1.8 in pom.xml)

<dependency>
      <groupId>org.apache.hadoop</groupId>
      <artifactId>hadoop-annotations</artifactId>
      <version>3.1.2</version>
 </dependency>

ch.epfl.scala:maven-bloop_2.13:1.4.11:bloopInstall got fail.
I think, maven-bloop doesn't search for a 2-depth dependency with 'system scope'.

  • It only search from remote repository not local file system(${java.home}/../lib/tools.jar (only when dependency of dependency)
2022.01.02 16:38:25 INFO  Downloading from central: https://repo.maven.apache.org/maven2/jdk/tools/jdk.tools/1.8/jdk.tools-1.8.jar
2022.01.02 16:38:27 INFO  [ERROR] FAILURE jdk.tools:jdk.tools:jar:1.8:system

...

2022.01.02 16:38:27 INFO  [ERROR] Failed to execute goal ch.epfl.scala:maven-bloop_2.13:1.4.11:bloopInstall (default-cli) on project json4s: Execution default-cli of goal ch.epfl.scala:maven-bloop_2.13:1.4.11:bloopInstall failed: Could not resolve jdk.tools:jdk.tools:jar:1.8:system -> [Help 1]

Doesn't it care of "scope" property of maven dependency?
https://github.com/scalacenter/bloop/blob/75fb344129bc92d3fff76f57429660e7014322c2/integrations/maven-bloop/src/main/scala/bloop/integrations/maven/MojoImplementation.scala#L83-L107


I have two solutions for not fixing it. but I don't like....

  • exclude the system scope dependency for each dependencies which has it.
  • add the dependency within my project.

Please check this!

@tgodzik
Copy link
Contributor

tgodzik commented Jan 4, 2022

Thanks for reporting! The issue might be connected to the fact that we try to resolve artifact within the system scope, while we should not have just use the provided path.

@jsngbin
Copy link
Author

jsngbin commented Jan 5, 2022

Thanks for reporting! The issue might be connected to the fact that we try to resolve artifact within the system scope, while we should not have just use the provided path.

I'm curious about we should not have just use the provided path you said.
Which case we should not have just use the path?
So, using 1-depth dependency will not guarantee working?

plz let me know!
thank you!

@tgodzik
Copy link
Contributor

tgodzik commented Jan 5, 2022

Ach sorry, I meant that we should use it 😅 Not sure how that not got in there.

@ckipp01 ckipp01 transferred this issue from scalacenter/bloop Dec 10, 2022
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