Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javadoc: error - invalid flag: -Xdoclint:none, when I use java 7, but it works in java 8

Tags:

java

maven

java-8

Maven works fine when I run my pom having <additionalparam>-Xdoclint:none</additionalparam> with JAVA 8, since -Xdoclint was added in JAVA 8. However, it throws an error when I run maven with JAVA 7 since it is not there in JAVA 7.

But I want to make the pom generalized for JAVA 7 and JAVA 8, i.e. if JAVA 8 I should be able to use the specified "additionalparam" but when using JAVA 7, it should exclude that parameter.

like image 897
Piyush Jajoo Avatar asked Jan 01 '15 06:01

Piyush Jajoo


2 Answers

Found Solution -

  <profiles>
    <profile>
      <id>doclint-java8-disable</id>
      <activation>
        <jdk>[1.8,)</jdk>
      </activation>
      <properties>
        <javadoc.opts>-Xdoclint:none</javadoc.opts>
      </properties>
    </profile>
  </profiles>

And then use ${javadoc.opts}

Credit - https://stackoverflow.com/a/26806103

like image 75
Piyush Jajoo Avatar answered Nov 06 '22 15:11

Piyush Jajoo


Instead of using the

<properties>
   <javadoc.opts>-Xdoclint:none</javadoc.opts>
</properties>

I used:

       <profile>
            <id>doclint-java8-disable</id>
            <activation>
                <jdk>[1.8,)</jdk>
            </activation>
            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-javadoc-plugin</artifactId>
                        <version>2.10.2</version>
                        <configuration>
                            <additionalparam>-Xdoclint:none</additionalparam>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
like image 23
jcgarciam Avatar answered Nov 06 '22 15:11

jcgarciam