melix / micronaut-license-report

An aggregating project to generate a license report
Apache License 2.0
1 stars 2 forks source link

License report fails for "micronaut-oracle-cloud@v3.1.0" with FileNotFoundExc `oci-java-sdk/bmc-bom/pom.xml` #24

Open MartinBalin opened 1 year ago

MartinBalin commented 1 year ago

Cloned tip of master. Modified build.gradle.kts to be like:

    val checkoutRepositories : List<String> = if (project.hasProperty("checkoutRepo")) checkoutRepo.split(",") else listOf();
    var repositoryNames : List<String> = checkoutRepositories.map {
        it.split('@').first();
    }

    listOf(
            "micronaut-oracle-cloud@v3.1.0"
    ).filter {
        !repositoryNames.contains(it.split('@').first())
    }.plus(
        checkoutRepositories
    ).filter {
      it.contains("micronaut")
    }.map {
        val (name, branch) = if (it.contains('@')) {
            it.split('@')
        } else {
            listOf(it, "master")
        }
        Pair("https://github.com/micronaut-projects/${name}.git", branch)
    }.forEach {
        checkout(it.first, it.second)
    }
}

Run the report using openjdk version "17.0.8.1" 2023-08-24 command line:

It fails after 1+minute with following error:

> Failed to apply plugin 'io.micronaut.build.internal.oraclecloud-bom'.
   > java.io.FileNotFoundException: /home/admin/dev/micronaut-license-report/checkouts/oci-java-sdk/bmc-bom/pom.xml (No such file or directory)

See full output below

Configuration cache is an incubating feature.
Calculating task graph as configuration cache cannot be reused because file 'build.gradle.kts' has changed.

> Task :checkoutMicronautOracleCloud
Checking out https://github.com/micronaut-projects/micronaut-oracle-cloud.git branch v3.1.0 in /home/admin/dev/micronaut-license-report/checkouts/micronaut-oracle-cloud
Path for java installation '/usr/lib/jvm/openjdk-17' (Common Linux Locations) does not contain a java executable
> Task :settings-build-logic:generateExternalPluginSpecBuilders FROM-CACHE
> Task :settings-build-logic:extractPrecompiledScriptPluginPlugins FROM-CACHE
> Task :settings-build-logic:compilePluginsBlocks FROM-CACHE
> Task :settings-build-logic:generatePrecompiledScriptPluginAccessors FROM-CACHE
> Task :settings-build-logic:generateScriptPluginAdapters FROM-CACHE
> Task :settings-build-logic:compileKotlin FROM-CACHE
> Task :settings-build-logic:compileJava NO-SOURCE
> Task :settings-build-logic:pluginDescriptors
> Task :settings-build-logic:processResources
> Task :settings-build-logic:classes
> Task :settings-build-logic:jar

> Task :reportForMicronautOracleCloud
Injecting init script /home/admin/dev/micronaut-license-report/src/init.gradle

Type-safe project accessors is an incubating feature.
> Task :buildSrc:extractPluginRequests FROM-CACHE
> Task :buildSrc:generatePluginAdapters FROM-CACHE
> Task :buildSrc:compileJava FROM-CACHE
> Task :buildSrc:compileGroovy NO-SOURCE
> Task :buildSrc:compileGroovyPlugins FROM-CACHE
> Task :buildSrc:pluginDescriptors
> Task :buildSrc:processResources
> Task :buildSrc:classes
> Task :buildSrc:jar

FAILURE: Build failed with an exception.

* Where:
Build file '/home/admin/dev/micronaut-license-report/checkouts/micronaut-oracle-cloud/oraclecloud-bom/build.gradle' line: 3

* What went wrong:
An exception occurred applying plugin request [id: 'io.micronaut.build.internal.oraclecloud-bom']
> Failed to apply plugin 'io.micronaut.build.internal.oraclecloud-bom'.
   > java.io.FileNotFoundException: /home/admin/dev/micronaut-license-report/checkouts/oci-java-sdk/bmc-bom/pom.xml (No such file or directory)

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Get more help at https://help.gradle.org.

Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

For more on this, please refer to https://docs.gradle.org/8.4/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation.

BUILD FAILED in 1m 11s
16 actionable tasks: 6 executed, 10 from cache

> Task :reportForMicronautOracleCloud
Could not execute build using connection to Gradle distribution 'https://services.gradle.org/distributions/gradle-8.4-bin.zip'.

0 problems were found storing the configuration cache.

See the complete report at file:///home/admin/dev/micronaut-license-report/build/reports/configuration-cache/2b71nq728reev27ibznjy1rjx/36dh3xzyasxyhqixyvabonid5/configuration-cache-report.html
melix commented 1 year ago

There is no easy fix for this one. You will have to edit one file after the project is cloned: in checkouts/micronaut-oracle-cloud, apply the following patch:

diff --git a/buildSrc/src/main/groovy/io.micronaut.build.internal.oraclecloud-bom.gradle b/buildSrc/src/main/groovy/io.micronaut.build.internal.oraclecloud-bom.gradle
index 268cc470..7b71ed83 100644
--- a/buildSrc/src/main/groovy/io.micronaut.build.internal.oraclecloud-bom.gradle
+++ b/buildSrc/src/main/groovy/io.micronaut.build.internal.oraclecloud-bom.gradle
@@ -12,7 +12,7 @@ if (!extraPropertiesExtension.has('ociArtifacts')) {
     String ociVersion = libs.oci.bom.get().version
     def ociArtifacts = parseOciBomArtifacts(ociVersion)

-    String ociProjectVersion = new XmlSlurper().parse("checkouts/oci-java-sdk/bmc-bom/pom.xml").version.text()
+    String ociProjectVersion = new XmlSlurper().parse("checkouts/micronaut-oracle-cloud/checkouts/oci-java-sdk/bmc-bom/pom.xml").version.text()
     def ociProjectArtifacts = parseOciBomArtifacts(ociProjectVersion)

     if (ociVersion != ociProjectVersion) {
MartinBalin commented 5 months ago

Comment as of Oracle Cloud module v 4.1.0 line has to be changed to: String ociProjectVersion = new XmlSlurper().parse("checkouts/micronaut-oracle-cloud/target/checkouts/oci-java-sdk/bmc-bom/pom.xml").version.text() target folder added to checkout of OCI SDK.