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

Linkage Checker to work with artifacts with classifiers #2173

Closed
suztomo opened this issue Aug 11, 2021 · 1 comment · Fixed by #2176
Closed

Linkage Checker to work with artifacts with classifiers #2173

suztomo opened this issue Aug 11, 2021 · 1 comment · Fixed by #2176
Labels
enhancement New feature or request p3

Comments

@suztomo
Copy link
Contributor

suztomo commented Aug 11, 2021

Linkage Checker to work with artifacts with classifiers

#2162 (comment)

Given build.gradle:

plugins {
    id 'java'
    id 'com.google.cloud.tools.linkagechecker' version "1.5.9"
}

group 'org.example'
version '1.0-SNAPSHOT'

repositories {
    mavenCentral()
}

dependencies {
    compile 'com.google.cloud:google-cloud-core:1.95.4'
    compile 'com.google.cloud:google-cloud-core:1.95.4:tests'
}

test {
    useJUnitPlatform()
}

linkageChecker {
    configurations = ['compile']
}

Running the command below fails:

./gradlew linkageCheck --stacktrace
...
* What went wrong:
Execution failed for task ':linkageCheck'.
> com.google.cloud:google-cloud-core:1.95.4 is not in the class path
...
Caused by: java.lang.IllegalArgumentException: com.google.cloud:google-cloud-core:1.95.4 is not in the class path
        at com.google.common.base.Preconditions.checkArgument(Preconditions.java:219)
        at com.google.cloud.tools.opensource.classpath.ClassPathResult.formatDependencyPaths(ClassPathResult.java:68)
        at com.google.cloud.tools.opensource.classpath.LinkageProblem.dependencyPathsOfProblematicJars(LinkageProblem.java:248)
        at com.google.cloud.tools.opensource.classpath.LinkageProblem.formatLinkageProblems(LinkageProblem.java:228)
        at com.google.cloud.tools.dependencies.gradle.LinkageCheckTask.findLinkageErrors(LinkageCheckTask.java:159)
        at com.google.cloud.tools.dependencies.gradle.LinkageCheckTask.run(LinkageCheckTask.java:98)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:104)

@suztomo
Copy link
Contributor Author

suztomo commented Aug 11, 2021

The plugin's createClassPathResult is returning a result with missing the test-classifier artifact.

Screen Shot 2021-08-11 at 10 34 21

Gradle's ResolvedConfiguration holds the test-classifier artifacts correctly.

The looking up the artifact is failing because the key (ClassPathEntry) needs to match artifact field and the Artifact class (implementation DefaultArtifact) requires to match the file. Test-classifier artifact has different file than the normal artifact.

Screen Shot 2021-08-11 at 10 39 49

That's why the error says "com.google.cloud:google-cloud-core:1.95.4 is not in the class path".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request p3
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants