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

Runtime Dependencies Not Resolved #16

Open RollandHobbieI11 opened 3 years ago

RollandHobbieI11 commented 3 years ago

When configuring the plugin, I see that only "compile" scope dependencies are resolved. From the plugin documentation I found that "compile" is the default scope, but can be overridden by using the "includeScope" parameter in the plugin configuration. However, including the "includeScope" parameter in the plugin configuration does not seem to work.

Below is an example pom.xml that reproduces the issue:

<?xml version="1.0" encoding="UTF-8"?>

<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>runtime-dependencies</groupId>
    <artifactId>runtime-dependencies</artifactId>
    <packaging>jar</packaging>
    <version>0.0.1-SNAPSHOT</version>
    <name>runtime-dependencies</name>

    <properties>
        <slf4j.version>1.7.30</slf4j.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>${slf4j.version}</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${slf4j.version}</version>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>com.carrotgarden.maven</groupId>
                <artifactId>flatten-maven-plugin</artifactId>
                <version>1.7.20200503171255</version>
                <configuration>
                    <performDependencyResolve>true</performDependencyResolve>
                    <includeScope>runtime</includeScope>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>flatten</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

</project>

After running mvn clean flatten:flatten I see in target/resolve.log that still only the "compile" scope dependencies are resolved.


The following files have been resolved:
   org.slf4j:slf4j-api:jar:1.7.30:compile