Praytic
Praytic

Reputation: 2041

How to activate maven profile setting based on JDK vendor

My ~/.m2/settings.xml file has a profile that I want to activate only when a specific vendor JDK is used. I read about <activation> tag in maven documentation, but it seems this tag doesn't have checks by the particular vendor. Any advice on how I can do it?

Upvotes: 1

Views: 256

Answers (1)

Allen D. Ball
Allen D. Ball

Reputation: 2026

You can test the java.vendor property with something like:

  <profiles>
    <profile>
      <id>AdoptOpenJDK</id>
      <activation>
        <property>
          <name>java.vendor</name>
          <value>AdoptOpenJDK</value>
        </property>
      </activation>
    </profile>
    ...
  </profiles>

Use java -XshowSettings:properties to determine the property values for your various JDKs:

$ java -XshowSettings:properties
Property settings:
    ...
    java.vendor = AdoptOpenJDK
    ...

Upvotes: 2

Related Questions