Skip to content

Add skipIfMissing flag - #187

Merged
slawekjaranowski merged 5 commits into
mojohaus:masterfrom
hgschmie:add-skip-missing
Nov 21, 2023
Merged

slawekjaranowski merged 5 commits into
mojohaus:masterfrom
hgschmie:add-skip-missing

Conversation

@hgschmie

@hgschmie hgschmie commented Sep 2, 2023

Copy link
Copy Markdown
Contributor
  • build-helper:add-source
  • build-helper:add-test-source
  • build-helper:add-resource
  • build-helper:add-test-resource

add flag <skipIfMissing>true|false<skipIfMissing>. If this flag is set
to true and a directory that should be added does not exist, skip it and
do not add it to the build. This allows a multi module build to use
these plugins unconditionally. E.g.

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>kotlin</id>
            <goals>
                <goal>add-source</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
                <skipIfMissing>true</skipIfMissing>
                <sources>
                    <source>${project.basedir}/src/main/kotlin</source>
                </sources>
            </configuration>
        </execution>
    </executions>
</plugin>

can be configured unconditionally and only modules that actually have a
src/main/kotlin folder will add this as a compile root.

@slawekjaranowski

Copy link
Copy Markdown
Member

please add tests for new parameters

@hgschmie

hgschmie commented Sep 3, 2023

Copy link
Copy Markdown
Contributor Author

please add tests for new parameters

Sure, but what is the point, given this:

[ERROR] The following builds failed:
[ERROR] *  released-version/pom.xml
[ERROR] *  reserve-ports/pom.xml
[ERROR] *  reserve-ports-with-urls/pom.xml
[ERROR] *  released-version-existing-asset-issue-108/pom.xml
[ERROR] *  reserve-ports-with-min-root-range/pom.xml
[ERROR] *  released-version-existing-asset/pom.xml
[ERROR] *  reserve-ports-with-min/pom.xml

@slawekjaranowski

Copy link
Copy Markdown
Member

please add tests for new parameters

Sure, but what is the point, given this:

[ERROR] The following builds failed:
[ERROR] *  released-version/pom.xml
[ERROR] *  reserve-ports/pom.xml
[ERROR] *  reserve-ports-with-urls/pom.xml
[ERROR] *  released-version-existing-asset-issue-108/pom.xml
[ERROR] *  reserve-ports-with-min-root-range/pom.xml
[ERROR] *  released-version-existing-asset/pom.xml
[ERROR] *  reserve-ports-with-min/pom.xml

fixed in #188 - thanks @hgschmie for point it

@slawekjaranowski slawekjaranowski added the enhancement New feature or request label Sep 3, 2023
@slawekjaranowski slawekjaranowski mentioned this pull request Sep 4, 2023
@slawekjaranowski slawekjaranowski self-assigned this Sep 20, 2023
- build-helper:add-source
- build-helper:add-test-source
- build-helper:add-resource
- build-helper:add-test-resource

add flag `<skipIfMissing>true|false<skipIfMissing>`. If this flag is set
to true and a directory that should be added does not exist, skip it and
do not add it to the build. This allows a multi module build to use
these plugins unconditionally. E.g.

```
<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>build-helper-maven-plugin</artifactId>
    <executions>
        <execution>
            <id>kotlin</id>
            <goals>
                <goal>add-source</goal>
            </goals>
            <phase>generate-sources</phase>
            <configuration>
                <skipIfMissing>true</skipIfMissing>
                <sources>
                    <source>${project.basedir}/src/main/kotlin</source>
                </sources>
            </configuration>
        </execution>
    </executions>
</plugin>
```

can be configured unconditionally and only modules that actually have a
`src/main/kotlin` folder will add this as a compile root.
Align with other plugins, use buildhelper prefix and plugin name.
@slawekjaranowski
slawekjaranowski merged commit ad1076e into mojohaus:master Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants