random-maven / flatten-maven-plugin

Simplify maven project descriptor for artifact deployment
https://random-maven.github.io/flatten-maven-plugin/flatten-mojo.html
Other
9 stars 5 forks source link

Optional dependencies lose their optionalness #8

Closed diamondq closed 4 years ago

diamondq commented 4 years ago

A dependency with an <optional>true</optional> set, loses this flag when copied over to the flattened pom. This seems like a simple fix in Support.resolveApplyDeclared (ie. dependency.setOptional(artifact.isOptional)); ).

EDIT: Turns out that the scenario only occurs if the dependency is NOT present in the local POM's section. For example, within a profile or a parent. If it's in the local POM, the existing code works fine.

Cheers

Andrei-Pozolotin commented 4 years ago

please PR

Andrei-Pozolotin commented 4 years ago
  1. thank you for PR, released: https://search.maven.org/artifact/com.carrotgarden.maven/flatten-maven-plugin

  2. please confirm v 1.7.x works for you https://github.com/random-maven/flatten-maven-plugin/releases

diamondq commented 4 years ago

Seems to be working great. Thanks