Domanda

I'm trying to use a Flex library (SWC) which defines a few dependencies within it's POM. I was hoping that Gradle would automatically provide those transitive depencencies. However, gradle dependencies shows just the one dependency that has been added manually.

merged
\--- com.example:flex-core:1.0.0

The POM file of the library contains the following:

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.example</groupId>
  <artifactId>flex-core</artifactId>
  <version>1.0.0-SNAPSHOT</version>
  <packaging>swc</packaging>
  <dependencies>
    <dependency>
      <groupId>org.as3commons</groupId>
      <artifactId>as3commons-lang</artifactId>
      <version>0.3.6</version>
      <type>swc</type>
      <scope>external</scope>
    </dependency>
    <dependency>
      <groupId>org.as3commons</groupId>
      <artifactId>as3commons-collections</artifactId>
      <version>1.3.2</version>
      <type>swc</type>
      <scope>external</scope>
    </dependency>
    <dependency>
      <groupId>org.as3commons</groupId>
      <artifactId>as3commons-reflect</artifactId>
      <version>1.6.0</version>
      <type>swc</type>
      <scope>external</scope>
    </dependency>
  </dependencies>
</project>

I've added the following dependency in my build.gradle:

dependencies {
    merged 'com.example:flex-core:1.0.0@swc'
}

Why is Gradle ignoring the dependencies from the POM? Is it because of the "external" scope? Is it possible to get those dependencies without adding them manually?

È stato utile?

Soluzione

You are using the artifact only notation when declaring your dependency (@scw). This means Gradle will only retrieve the artifact itself but not use the transitive dependencies from the POM.

Try this instead:

dependencies {
    merged 'com.example:core:1.0.0'
}

Shouldn't the name be flex-core? At least that's what the POM says above.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top