What is endorseddirs and how it is used in a application?
In respect to the maven-compiler-plugin. There is a setting added to my project's POM file. The configuration is given below.
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
开发者_JS百科 <artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<compilerArguments>
<endorseddirs>${endorsed.dir}</endorseddirs>
</compilerArguments>
</configuration>
</plugin>
</plugins>
What does it mean to have a <endorseddirs>
in the compiler arguments? How does it works with java compiler?
From the documentation of Endorsed Standards Override Mechanism, it is a mechanism to provide newer versions of an endorsed standard than those included in the Java 2 Platform
Your project must be creating and/or using such an implementation.
By specifying <endorseddirs>
attribute, you are instructing the java compiler to look at jars present in this folder to override similarly defined classes in the standard jdk.
By Java documentation, java.endorsed.dirs
is used to provide an Endorsed Standards Override Mechanism. Which means, a user can provide newer versions of certain packages than those provided by the JDK. If there are newer implementations of these packages in the directories specified by java.endorsed.dirs, those implementations will be loaded instead of the default ones that come with the JDK.
The packages that can be overriden this way are grouped into Endorsed Standards APIs and Standalone Technologies, and are listed in the Java documentation.
Roughly speaking the Endorsed Standards APIs include:
- javax.rmi.CORBA
- various org.omg.* packages
- org.w3c.dom
- various org.xml.sax.* packages
Standalone Technologies include:
- Java API for XML Processing (JAXP), version 1.4
- Java Architecture for XML Binding (JAXB), version 2.0
- Java API for XML-Based Web Services (JAX-WS), version 2.0
- Java Compiler API, version 1.0
- Pluggable Annotation Processing API, version 1.0
- Common Annotations for the Java Platform, version 1.0
- Scripting for the Java Platform, version 1.0
- SOAP with Attachments API for Java (SAAJ), version 1.3
精彩评论