Skip to content

Incorrect warning being emitted: "Invalid goal for this plugin" when leveraging properties set in profiles #638

@kwin

Description

@kwin

Whenever a plugin goal is set to a property which is only set within profiles the following warning is being emitted:

Invalid goal for this plugin: ${myProperty}

Seems that interpolation is not correctly done in

private Optional<Diagnostic> internalValidateGoal(DiagnosticRequest diagnosticReq, PluginDescriptor pluginDescriptor) {
.

This can be reproduced for example with https://github.com/apache/jackrabbit-filevault, which contains

  <build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>com.diffplug.spotless</groupId>
          <artifactId>spotless-maven-plugin</artifactId>
          <version>3.1.0</version>
          <executions>
            <execution>
              <id>spotless-format</id>
              <goals>
                <goal>${spotless.action}</goal>
              </goals>
              <phase>process-sources</phase>
            </execution>
          </executions>
        </plugin>
        ...
  <profiles>
    ...
    <profile>
      <id>format-check</id>
      <activation>
        <property>
          <name>env.CI</name>
        </property>
      </activation>
      <properties>
        <spotless.action>check</spotless.action>
      </properties>
    </profile>
    <profile>
      <id>format</id>
      <activation>
        <property>
          <name>!env.CI</name>
        </property>
      </activation>
      <properties>
        <spotless.action>apply</spotless.action>
      </properties>
    </profile>
    ...

(in https://github.com/apache/jackrabbit-filevault/blob/master/parent/pom.xml)

This emits

Invalid goal for this plugin: ${spotless.action}

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