Skip to content

<optional> of transitive dependencies when <flattenMavenMode> is "all" #160

Closed
@yangnuoyu

Description

@yangnuoyu

When I tried to flatten a pom with dependencies whose is "true" and set flattenDependencyMode == all, I got a flattened pom which parsed the transitive dependencies but with the as "false". I am wondering if it is a potential problem.

The pom we want to flatten contains dependencies:

  <dependencies>
    <dependency>
      <groupId>org.codehaus.mojo.flatten.its</groupId>
      <artifactId>core</artifactId>
      <version>3.2.1</version>
      <optional>true</optional>
    </dependency>
  </dependencies>

The core has transitive dependency:

  <dependencies>
    <dependency>
      <groupId>org.codehaus.mojo.flatten.its</groupId>
      <artifactId>dep</artifactId>
      <version>3.2.1</version>
    </dependency>
  </dependencies>

What I got in the flattened pom:

  <dependencies>
    <dependency>
      <groupId>org.codehaus.mojo.flatten.its</groupId>
      <artifactId>core</artifactId>
      <version>3.2.1</version>
      <scope>compile</scope>
      <exclusions>
        <exclusion>
          <artifactId>dep</artifactId>
          <groupId>org.codehaus.mojo.flatten.its</groupId>
        </exclusion>
      </exclusions>
      <optional>true</optional>
    </dependency>
    <dependency>
      <groupId>org.codehaus.mojo.flatten.its</groupId>
      <artifactId>dep</artifactId>
      <version>3.2.1</version>
      <scope>compile</scope>
      <optional>false</optional>
    </dependency>
  </dependencies>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions