cbeust / kobalt

A Kotlin-based build system for the JVM.
Apache License 2.0
433 stars 60 forks source link

Kobalt sometimes attempts resolution of optional dependencies #379

Closed rhencke closed 7 years ago

rhencke commented 7 years ago

Create a new project using kobaltw --init java, and then add the following dependency to its 'compile' section:

    dependencies {
        compile("org.springframework:spring-context-support:2.5.6.SEC03")
    }

If you attempt to run kobaltw assemble, you will see the following:

c:\Source\github.com\rhencke\test3>kobaltw assemble
            _  __          _               _   _
           | |/ /   ___   | |__     __ _  | | | |_
           | ' /   / _ \  | '_ \   / _` | | | | __|
           | . \  | (_) | | |_) | | (_| | | | | |_
           |_|\_\  \___/  |_.__/   \__,_| |_|  \__|  1.0.44

Parallel build starting
     ╔════════════════╗
     ║ Building test3 ║
     ╚════════════════╝
───── test3:compile
*****
***** ERROR Error: org.eclipse.aether.resolution.DependencyResolutionException: The following artifacts could not be resolved: com.bea.wlplatform:commonj-twm:jar:1.1, com.oracle:oc4j:jar:1.0: Could not find artifact com.bea.wlplatform:commonj-twm:jar:1.1 in  (https://jcenter.bintray.com/), try downloading from http://ftpna2.bea.com/pub/downloads/commonj/commonj-twm.jar
*****

Thread report
╔════════════════════════════════════════╗
║  Time (sec) ║ Thread 14                ║
╠════════════════════════════════════════╣
║  0          ║ test3                    ║
╚════════════════════════════════════════╝
PARALLEL BUILD SUCCESSFUL (4 SECONDS), sequential build would have taken 0 seconds

Though the build is reported as successful, there is an error related to the resolution of artifacts com.bea.wlplatform:commonj-twm:jar:1.1 and com.oracle:oc4j:jar:1.0:. If you view the POM for org.springframework:spring-context-support:2.5.6.SEC03, you will find these are optional dependencies:

        <dependency>
            <groupId>com.bea.wlplatform</groupId>
            <artifactId>commonj-twm</artifactId>
            <version>1.1</version>
            <optional>true</optional>
        </dependency>
...
        <dependency>
            <groupId>com.oracle</groupId>
            <artifactId>oc4j</artifactId>
            <version>1.0</version>
            <optional>true</optional>
        </dependency>

(This is more of an issue when attempting to sync a Kobalt project in IntelliJ IDEA, as it will error with: Error:Received error message from Kobalt server: The following artifacts could not be resolved: com.bea.wlplatform:commonj-twm:jar:1.1, com.oracle:oc4j:jar:1.0: Could not find artifact com.bea.wlplatform:commonj-twm:jar:1.1 in (https://jcenter.bintray.com/), try downloading from http://ftpna2.bea.com/pub/downloads/commonj/commonj-twm.jar)

cbeust commented 7 years ago

Filed https://issues.apache.org/jira/browse/MRESOLVER-21

cbeust commented 7 years ago

Ok, so it turns out this is not a bug in Kobalt nor Maven Resolver. I added comments to the MRESOLVER issue above, go read it.

cbeust commented 7 years ago

Progress: bintray informed me they have removed the bogus dependency (commons-logging:commons-logging:99.0) from JCenter.

However, they haven't updated maven-metadata.xml, I asked them to do that as well and once it's done, this should pass.

cbeust commented 7 years ago

Progress: bintray informed me they updated the maven-metadata.xml and that removed all trace of the bogus version.

I was able to successfully do:

./kobaltw --resolve org.springframework:spring-context-support:jar:2.5.6.SEC03