Uploaded image for project: 'Maven'
  1. Maven
  2. MNG-6943

Activate profile depending of jdk version used in toolchain

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • None
    • None
    • None

    Description

      I have one profile to configure maven-javadoc-plugin which is only activate for jdk 1.8 or greater. (doclint exist since java 1.8)
      And another profile to use toolchain with jdk 1.7.

      <profile>
          <id>configure-doclint</id>
          <activation>
              <jdk>[1.8,)</jdk>
          </activation>
          <build>
              <plugins>
                  <plugin>
                      <groupId>org.apache.maven.plugins</groupId>
                      <artifactId>maven-javadoc-plugin</artifactId>
                      <configuration>
                          <doclint>all,-missing</doclint>
                      </configuration>
                  </plugin>
              </plugins>
          </build>
      </profile>
      <profile>
          <id>useToolchain</id>
          <build>
              <plugins>
                  <plugin>
                      <artifactId>maven-toolchains-plugin</artifactId>
                      <executions>
                          <execution>
                              <goals>
                                  <goal>toolchain</goal>
                              </goals>
                          </execution>
                      </executions>
                      <configuration>
                          <toolchains>
                              <jdk>
                                  <version>1.7</version>
                              </jdk>
                          </toolchains>
                      </configuration>
                  </plugin>
              </plugins>
          </build>
      </profile>
      

      The issue is that if I run  "mvn install javadoc:javadoc -PuseToolchain" with java 8 or greater, t}}his will failed with a "{{Exit code: 1 - javadoc: error - invalid flag: -Xdoclint:none"

      I guess this is because jdk version which run maven is used instead of toolchain jdk version  to decide to activate or not "configure-doclint" profile.

      Maybe it could make sense to add a new profile activation field <toolchain-jdk>.
      If no toolchain is used the current running version of maven should be used and so in this case behave like <jdk>

      WDYT ?

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              sbernard Simon
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated: