GMavenPlus icon indicating copy to clipboard operation
GMavenPlus copied to clipboard

groovydoc goal not executed despite being listed in executions

Open reckart opened this issue 9 years ago • 5 comments

I don't understand why the groovydoc and testGroovydoc goals are not executed despite being listed in the execution. If I directly invoke it from the command line, it works. Not that the other goals appear all to be properly executed.

  <profiles>
    <profile>
      <id>groovy</id>
      <activation>
        <file>
          <exists>src/main/groovy</exists>
        </file>
      </activation>
      <dependencies>
        <dependency>
          <groupId>org.codehaus.groovy</groupId>
          <artifactId>groovy</artifactId>
        </dependency>
        <dependency>
          <groupId>org.codehaus.groovy</groupId>
          <artifactId>groovy-all</artifactId>
          <version>${groovy.version}</version>
        </dependency>
        <dependency>
          <groupId>org.codehaus.groovy</groupId>
          <artifactId>groovy-templates</artifactId>
        </dependency>
      </dependencies>
      <build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.gmavenplus</groupId>
            <artifactId>gmavenplus-plugin</artifactId>
            <version>1.5</version>
            <executions>
              <execution>
                <goals>
                  <goal>addSources</goal>
                  <goal>addTestSources</goal>
                  <goal>generateStubs</goal>
                  <goal>compile</goal>
                  <goal>testGenerateStubs</goal>
                  <goal>testCompile</goal>
                  <goal>groovydoc</goal>
                  <goal>testGroovydoc</goal>
                  <goal>removeStubs</goal>
                  <goal>removeTestStubs</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

reckart avatar Aug 12 '16 16:08 reckart

Adding the goals into a separate execution and binding that explicitly to a phase seems to work though:

<build>
        <plugins>
          <plugin>
            <groupId>org.codehaus.gmavenplus</groupId>
            <artifactId>gmavenplus-plugin</artifactId>
            <version>1.5</version>
            <executions>
              <execution>
                <id>build</id>
                <goals>
                  <goal>addSources</goal>
                  <goal>addTestSources</goal>
                  <goal>generateStubs</goal>
                  <goal>compile</goal>
                  <goal>testGenerateStubs</goal>
                  <goal>testCompile</goal>
                  <goal>removeStubs</goal>
                  <goal>removeTestStubs</goal>
                </goals>
              </execution>
              <execution>
                <id>documentation</id>
                <phase>package</phase>
                <goals>
                  <goal>groovydoc</goal>
                  <goal>testGroovydoc</goal>
                </goals>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>

reckart avatar Aug 12 '16 16:08 reckart

It's because the Groovydoc goals are not associated with any phase by default. Ideally, someday I'd make the Groovydoc a proper Maven site plugin. But until then, there wasn't any phase in the default build lifecycle that felt appropriate to bind to by default.

keeganwitt avatar Aug 12 '16 18:08 keeganwitt

Why not the package phase?

reckart avatar Aug 12 '16 18:08 reckart

Well, probably prepare-package would be better or even binding the groovydoc and testGrooydoc to separate phase, e.g. process-classes and process-test-classes.

Eventually, I switched back to the groovydoc maven plugin for the being because that also creates the docs JAR and attaches it to the build. This is required in order to release artifacts to Maven Central.

reckart avatar Aug 12 '16 18:08 reckart

Well, the mojo could be called as part of site, or as part of building a Groovydoc jar. And you'd want it bound to different phases, depending on the usage. Right now, I don't build jars of Groovydoc, but maybe I could add a new mojo to do that and bind to package phase the same way groovydoc maven plugin does -- let me give it some thought.

keeganwitt avatar Aug 12 '16 19:08 keeganwitt