jdk.tools wrapper

Universal dependency to build against jdk.tools (AKA tools.jar) in a portable way

Лицензия

Лицензия

Категории

Категории

Java Языки программирования Maven Компиляция и сборка
Группа

Группа

com.github.olivergondza
Идентификатор

Идентификатор

maven-jdk-tools-wrapper
Последняя версия

Последняя версия

0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

jdk.tools wrapper
Universal dependency to build against jdk.tools (AKA tools.jar) in a portable way
Ссылка на сайт

Ссылка на сайт

https://github.com/olivergondza/maven-jdk-tools-wrapper
Система контроля версий

Система контроля версий

https://github.com/olivergondza/maven-jdk-tools-wrapper

Скачать maven-jdk-tools-wrapper

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.olivergondza/maven-jdk-tools-wrapper/ -->
<dependency>
    <groupId>com.github.olivergondza</groupId>
    <artifactId>maven-jdk-tools-wrapper</artifactId>
    <version>0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.olivergondza/maven-jdk-tools-wrapper/
implementation 'com.github.olivergondza:maven-jdk-tools-wrapper:0.1'
// https://jarcasting.com/artifacts/com.github.olivergondza/maven-jdk-tools-wrapper/
implementation ("com.github.olivergondza:maven-jdk-tools-wrapper:0.1")
'com.github.olivergondza:maven-jdk-tools-wrapper:jar:0.1'
<dependency org="com.github.olivergondza" name="maven-jdk-tools-wrapper" rev="0.1">
  <artifact name="maven-jdk-tools-wrapper" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.olivergondza', module='maven-jdk-tools-wrapper', version='0.1')
)
libraryDependencies += "com.github.olivergondza" % "maven-jdk-tools-wrapper" % "0.1"
[com.github.olivergondza/maven-jdk-tools-wrapper "0.1"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

Maven jdk.tools wrapper

Universal dependency to build against jdk.tools (AKA tools.jar) in a portable way

TL;DR

When maven gives you headaches trying to use some of the tools.jar classes (because the system scoped dependency have different paths in different JDKs or does not even exist), following dependency should get you going:

    <dependency>
      <groupId>com.github.olivergondza</groupId>
      <artifactId>maven-jdk-tools-wrapper</artifactId>
      <version>0.1</version>
    </dependency>

Problem

Prior Jigsaw introduced in Java 9, maven needs to pass the jar on javac classpath at compile time to build projects referring to its classes. Despite the fact the jar is distributed together with JDK, maven needs to be instructed to use it explicitly. system dependency scope is here to do just that but there are still some caveats to keep in mind:

Solution

There are tricks to get this working across Java versions and systems. Maven profiles can distinguish those situations and declare particular dependency if needed. Consult the pom.xml for more details.

As the actual maven wizardry is quite elaborate, surprising to newcomers and a subject of future improvements, it is better not co copy-paste it around. Hence this module exists so you do not have to know or care about the details.

This dependency (hosted on maven central) do not have any runtime footprint (external dependencies, classes loaded) but merely instruct maven what to do on compile time. All the transitive dependencies brought to the client projects are system scoped.

Версии библиотеки

Версия
0.1