Я пытаюсь скомпилировать и запустить модульный проект Java с open-jdk-11 под Eclipse.
Main.java:
package aubin;
import java.io.File;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBElement;
import javax.xml.bind.Unmarshaller;
import disapp.generator.model.DisappType; // JAXB generated class
public class Main {
public static void main( String[] args ) throws Exception {
final JAXBContext jaxbContext =
JAXBContext.newInstance( "disapp.generator.model" );
final Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
@SuppressWarnings("unchecked")
final JAXBElement<DisappType> elt =
(JAXBElement<DisappType>)unmarshaller.unmarshal( new File( args[0] ));
final DisappType application = elt.getValue();
System.out.println( application.getName());
}
}
module-info.java:
module aubin {
requires java.base;
requires java.xml;
requires java.xml.bind;
}
Компиляция под Eclipse в порядке:
Но Eclipse run говорит:
Произошла ошибка во время инициализации загрузкиlayer java.lang.module.ResolutionException: модули jaxb.core и jaxb.impl экспортируют пакет com.sun.xml.bind.v2.model.util в модуль aubin
Запуск командной строки говорит:
$ java -version
openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3)
OpenJDK 64-Bit Server VM (build 11.0.4+11-post-Ubuntu-1ubuntu218.04.3, mixed mode, sharing)
$ java --module-path lib:bin aubin.Main dab.xml
Error occurred during initialization of boot layer
java.lang.module.FindException: Two versions of module java.activation found in lib (javax.activation-api-1.2.0.jar and javax.activation-1.2.0.jar)
$ java --show-module-resolution --module-path lib:bin aubin.Main dab.xml
root java.sql jrt:/java.sql
root java.rmi jrt:/java.rmi
root jdk.management.jfr jrt:/jdk.management.jfr
root jdk.jdi jrt:/jdk.jdi
root java.logging jrt:/java.logging
root java.xml.crypto jrt:/java.xml.crypto
root java.transaction.xa jrt:/java.transaction.xa
root jdk.xml.dom jrt:/jdk.xml.dom
root java.xml jrt:/java.xml
root jdk.jfr jrt:/jdk.jfr
root java.datatransfer jrt:/java.datatransfer
root jdk.httpserver jrt:/jdk.httpserver
root jdk.net jrt:/jdk.net
root java.naming jrt:/java.naming
root java.desktop jrt:/java.desktop
root java.prefs jrt:/java.prefs
root java.net.http jrt:/java.net.http
root jdk.compiler jrt:/jdk.compiler
root java.security.sasl jrt:/java.security.sasl
root jdk.jconsole jrt:/jdk.jconsole
root jdk.attach jrt:/jdk.attach
root java.base jrt:/java.base
root jdk.javadoc jrt:/jdk.javadoc
root jdk.jshell jrt:/jdk.jshell
root java.sql.rowset jrt:/java.sql.rowset
root jdk.jsobject jrt:/jdk.jsobject
root java.management jrt:/java.management
root jdk.sctp jrt:/jdk.sctp
root java.smartcardio jrt:/java.smartcardio
root jdk.unsupported jrt:/jdk.unsupported
root jdk.scripting.nashorn jrt:/jdk.scripting.nashorn
root java.instrument jrt:/java.instrument
root java.security.jgss jrt:/java.security.jgss
root jdk.management jrt:/jdk.management
root jdk.security.auth jrt:/jdk.security.auth
root java.compiler jrt:/java.compiler
root java.scripting jrt:/java.scripting
root jdk.dynalink jrt:/jdk.dynalink
root jdk.unsupported.desktop jrt:/jdk.unsupported.desktop
root jdk.accessibility jrt:/jdk.accessibility
root jdk.jartool jrt:/jdk.jartool
root java.management.rmi jrt:/java.management.rmi
root jdk.security.jgss jrt:/jdk.security.jgss
jdk.security.jgss requires java.logging jrt:/java.logging
jdk.security.jgss requires java.security.jgss jrt:/java.security.jgss
jdk.security.jgss requires java.security.sasl jrt:/java.security.sasl
java.management.rmi requires java.management jrt:/java.management
java.management.rmi requires java.rmi jrt:/java.rmi
java.management.rmi requires java.naming jrt:/java.naming
jdk.accessibility requires java.desktop jrt:/java.desktop
jdk.unsupported.desktop requires java.desktop jrt:/java.desktop
jdk.dynalink requires java.logging jrt:/java.logging
jdk.security.auth requires java.security.jgss jrt:/java.security.jgss
jdk.security.auth requires java.naming jrt:/java.naming
jdk.management requires java.management jrt:/java.management
java.security.jgss requires java.naming jrt:/java.naming
jdk.scripting.nashorn requires java.scripting jrt:/java.scripting
jdk.scripting.nashorn requires java.logging jrt:/java.logging
jdk.scripting.nashorn requires jdk.dynalink jrt:/jdk.dynalink
jdk.jsobject requires java.desktop jrt:/java.desktop
java.sql.rowset requires java.logging jrt:/java.logging
java.sql.rowset requires java.naming jrt:/java.naming
java.sql.rowset requires java.sql jrt:/java.sql
jdk.jshell requires java.logging jrt:/java.logging
jdk.jshell requires java.compiler jrt:/java.compiler
jdk.jshell requires jdk.compiler jrt:/jdk.compiler
jdk.jshell requires jdk.jdi jrt:/jdk.jdi
jdk.jshell requires jdk.internal.opt jrt:/jdk.internal.opt
jdk.jshell requires jdk.internal.le jrt:/jdk.internal.le
jdk.jshell requires jdk.internal.ed jrt:/jdk.internal.ed
jdk.jshell requires java.prefs jrt:/java.prefs
jdk.javadoc requires java.compiler jrt:/java.compiler
jdk.javadoc requires java.xml jrt:/java.xml
jdk.javadoc requires jdk.compiler jrt:/jdk.compiler
jdk.attach requires jdk.internal.jvmstat jrt:/jdk.internal.jvmstat
jdk.jconsole requires jdk.attach jrt:/jdk.attach
jdk.jconsole requires jdk.management.agent jrt:/jdk.management.agent
jdk.jconsole requires java.desktop jrt:/java.desktop
jdk.jconsole requires java.rmi jrt:/java.rmi
jdk.jconsole requires jdk.management jrt:/jdk.management
jdk.jconsole requires jdk.internal.jvmstat jrt:/jdk.internal.jvmstat
jdk.jconsole requires java.management.rmi jrt:/java.management.rmi
jdk.jconsole requires java.management jrt:/java.management
java.security.sasl requires java.logging jrt:/java.logging
jdk.compiler requires java.compiler jrt:/java.compiler
java.prefs requires java.xml jrt:/java.xml
java.desktop requires java.xml jrt:/java.xml
java.desktop requires java.datatransfer jrt:/java.datatransfer
java.desktop requires java.prefs jrt:/java.prefs
java.naming requires java.security.sasl jrt:/java.security.sasl
jdk.xml.dom requires java.xml jrt:/java.xml
java.xml.crypto requires java.logging jrt:/java.logging
java.xml.crypto requires java.xml jrt:/java.xml
jdk.jdi requires jdk.attach jrt:/jdk.attach
jdk.jdi requires jdk.jdwp.agent jrt:/jdk.jdwp.agent
jdk.management.jfr requires jdk.management jrt:/jdk.management
jdk.management.jfr requires jdk.jfr jrt:/jdk.jfr
jdk.management.jfr requires java.management jrt:/java.management
java.rmi requires java.logging jrt:/java.logging
java.sql requires java.logging jrt:/java.logging
java.sql requires java.xml jrt:/java.xml
java.sql requires java.transaction.xa jrt:/java.transaction.xa
jdk.management.agent requires java.management.rmi jrt:/java.management.rmi
jdk.management.agent requires java.management jrt:/java.management
Error occurred during initialization of boot layer
java.lang.module.FindException: Two versions of module java.activation found in lib (javax.activation-api-1.2.0.jar and javax.activation-1.2.0.jar)
Обратите внимание, что компиляция командной строки тоже не удалась:
$ javac -source 11 --module-path lib -d build src/module-info.java src/aubin/Main.java src-gen/disapp/generator/model/*.java
error: duplicate module on application module path
module in java.activation
error: the unnamed module reads package com.sun.xml.bind from both jaxb.core and jaxb.impl
error: the unnamed module reads package com.sun.xml.bind.util from both jaxb.core and jaxb.impl
error: the unnamed module reads package com.sun.xml.bind.annotation from both jaxb.core and jaxb.impl
error: the unnamed module reads package com.sun.xml.bind.v2 from both jaxb.core and jaxb.impl
error: the unnamed module reads package com.sun.xml.bind.v2.util from both jaxb.core and jaxb.impl
error: the unnamed module reads package com.sun.xml.bind.v2.schemagen.episode from both jaxb.core and jaxb.impl
error: the unnamed module reads package com.sun.xml.bind.v2.runtime from both jaxb.core and jaxb.impl
error: the unnamed module reads package com.sun.xml.bind.v2.runtime.unmarshaller from both jaxb.core and jaxb.impl
error: the unnamed module reads package com.sun.xml.bind.v2.model.util from both jaxb.core and jaxb.impl
error: the unnamed module reads package com.sun.xml.bind.v2.model.nav from both jaxb.core and jaxb.impl
error: the unnamed module reads package com.sun.xml.bind.v2.model.core from both jaxb.core and jaxb.impl
error: the unnamed module reads package com.sun.xml.bind.v2.model.impl from both jaxb.core and jaxb.impl
error: the unnamed module reads package com.sun.xml.bind.v2.model.annotation from both jaxb.core and jaxb.impl
error: the unnamed module reads package com.sun.xml.bind.unmarshaller from both jaxb.core and jaxb.impl
error: the unnamed module reads package com.sun.xml.bind.marshaller from both jaxb.core and jaxb.impl
error: the unnamed module reads package com.sun.xml.bind.api from both jaxb.core and jaxb.impl
error: the unnamed module reads package com.sun.xml.bind.api.impl from both jaxb.core and jaxb.impl
error: module jaxb.impl reads package com.sun.xml.bind from both jaxb.core and jaxb.impl
error: module jaxb.impl reads package com.sun.xml.bind.util from both jaxb.core and jaxb.impl
error: module jaxb.impl reads package com.sun.xml.bind.annotation from both jaxb.core and jaxb.impl
error: module jaxb.impl reads package com.sun.xml.bind.v2 from both jaxb.core and jaxb.impl
error: module jaxb.impl reads package com.sun.xml.bind.v2.util from both jaxb.core and jaxb.impl
error: module jaxb.impl reads package com.sun.xml.bind.v2.schemagen.episode from both jaxb.core and jaxb.impl
error: module jaxb.impl reads package com.sun.xml.bind.v2.runtime from both jaxb.core and jaxb.impl
error: module jaxb.impl reads package com.sun.xml.bind.v2.runtime.unmarshaller from both jaxb.core and jaxb.impl
error: module jaxb.impl reads package com.sun.xml.bind.v2.model.util from both jaxb.core and jaxb.impl
error: module jaxb.impl reads package com.sun.xml.bind.v2.model.nav from both jaxb.core and jaxb.impl
error: module jaxb.impl reads package com.sun.xml.bind.v2.model.core from both jaxb.core and jaxb.impl
error: module jaxb.impl reads package com.sun.xml.bind.v2.model.impl from both jaxb.core and jaxb.impl
error: module jaxb.impl reads package com.sun.xml.bind.v2.model.annotation from both jaxb.core and jaxb.impl
error: module jaxb.impl reads package com.sun.xml.bind.unmarshaller from both jaxb.core and jaxb.impl
error: module jaxb.impl reads package com.sun.xml.bind.marshaller from both jaxb.core and jaxb.impl
error: module jaxb.impl reads package com.sun.xml.bind.api from both jaxb.core and jaxb.impl
error: module jaxb.impl reads package com.sun.xml.bind.api.impl from both jaxb.core and jaxb.impl
error: module jaxb.core reads package com.sun.xml.bind from both jaxb.impl and jaxb.core
error: module jaxb.core reads package com.sun.xml.bind.util from both jaxb.impl and jaxb.core
error: module jaxb.core reads package com.sun.xml.bind.api.impl from both jaxb.impl and jaxb.core
error: module jaxb.core reads package com.sun.xml.bind.api from both jaxb.impl and jaxb.core
error: module jaxb.core reads package com.sun.xml.bind.annotation from both jaxb.impl and jaxb.core
error: module jaxb.core reads package com.sun.xml.bind.unmarshaller from both jaxb.impl and jaxb.core
error: module jaxb.core reads package com.sun.xml.bind.marshaller from both jaxb.impl and jaxb.core
error: module jaxb.core reads package com.sun.xml.bind.v2 from both jaxb.impl and jaxb.core
error: module jaxb.core reads package com.sun.xml.bind.v2.util from both jaxb.impl and jaxb.core
error: module jaxb.core reads package com.sun.xml.bind.v2.schemagen.episode from both jaxb.impl and jaxb.core
error: module jaxb.core reads package com.sun.xml.bind.v2.model.annotation from both jaxb.impl and jaxb.core
error: module jaxb.core reads package com.sun.xml.bind.v2.model.util from both jaxb.impl and jaxb.core
error: module jaxb.core reads package com.sun.xml.bind.v2.model.impl from both jaxb.impl and jaxb.core
error: module jaxb.core reads package com.sun.xml.bind.v2.model.nav from both jaxb.impl and jaxb.core
error: module jaxb.core reads package com.sun.xml.bind.v2.model.core from both jaxb.impl and jaxb.core
error: module jaxb.core reads package com.sun.xml.bind.v2.runtime from both jaxb.impl and jaxb.core
error: module jaxb.core reads package com.sun.xml.bind.v2.runtime.unmarshaller from both jaxb.impl and jaxb.core
error: module java.activation reads package com.sun.xml.bind from both jaxb.core and jaxb.impl
error: module java.activation reads package com.sun.xml.bind.util from both jaxb.core and jaxb.impl
error: module java.activation reads package com.sun.xml.bind.annotation from both jaxb.core and jaxb.impl
error: module java.activation reads package com.sun.xml.bind.v2 from both jaxb.core and jaxb.impl
error: module java.activation reads package com.sun.xml.bind.v2.util from both jaxb.core and jaxb.impl
error: module java.activation reads package com.sun.xml.bind.v2.schemagen.episode from both jaxb.core and jaxb.impl
error: module java.activation reads package com.sun.xml.bind.v2.runtime from both jaxb.core and jaxb.impl
error: module java.activation reads package com.sun.xml.bind.v2.runtime.unmarshaller from both jaxb.core and jaxb.impl
error: module java.activation reads package com.sun.xml.bind.v2.model.util from both jaxb.core and jaxb.impl
error: module java.activation reads package com.sun.xml.bind.v2.model.nav from both jaxb.core and jaxb.impl
error: module java.activation reads package com.sun.xml.bind.v2.model.core from both jaxb.core and jaxb.impl
error: module java.activation reads package com.sun.xml.bind.v2.model.impl from both jaxb.core and jaxb.impl
error: module java.activation reads package com.sun.xml.bind.v2.model.annotation from both jaxb.core and jaxb.impl
error: module java.activation reads package com.sun.xml.bind.unmarshaller from both jaxb.core and jaxb.impl
error: module java.activation reads package com.sun.xml.bind.marshaller from both jaxb.core and jaxb.impl
error: module java.activation reads package com.sun.xml.bind.api from both jaxb.core and jaxb.impl
error: module java.activation reads package com.sun.xml.bind.api.impl from both jaxb.core and jaxb.impl
error: module java.xml.bind reads package com.sun.xml.bind from both jaxb.core and jaxb.impl
error: module java.xml.bind reads package com.sun.xml.bind.util from both jaxb.core and jaxb.impl
error: module java.xml.bind reads package com.sun.xml.bind.annotation from both jaxb.core and jaxb.impl
error: module java.xml.bind reads package com.sun.xml.bind.v2 from both jaxb.core and jaxb.impl
error: module java.xml.bind reads package com.sun.xml.bind.v2.util from both jaxb.core and jaxb.impl
error: module java.xml.bind reads package com.sun.xml.bind.v2.schemagen.episode from both jaxb.core and jaxb.impl
error: module java.xml.bind reads package com.sun.xml.bind.v2.runtime from both jaxb.core and jaxb.impl
error: module java.xml.bind reads package com.sun.xml.bind.v2.runtime.unmarshaller from both jaxb.core and jaxb.impl
error: module java.xml.bind reads package com.sun.xml.bind.v2.model.util from both jaxb.core and jaxb.impl
error: module java.xml.bind reads package com.sun.xml.bind.v2.model.nav from both jaxb.core and jaxb.impl
error: module java.xml.bind reads package com.sun.xml.bind.v2.model.core from both jaxb.core and jaxb.impl
error: module java.xml.bind reads package com.sun.xml.bind.v2.model.impl from both jaxb.core and jaxb.impl
error: module java.xml.bind reads package com.sun.xml.bind.v2.model.annotation from both jaxb.core and jaxb.impl
error: module java.xml.bind reads package com.sun.xml.bind.unmarshaller from both jaxb.core and jaxb.impl
error: module java.xml.bind reads package com.sun.xml.bind.marshaller from both jaxb.core and jaxb.impl
error: module java.xml.bind reads package com.sun.xml.bind.api from both jaxb.core and jaxb.impl
error: module java.xml.bind reads package com.sun.xml.bind.api.impl from both jaxb.core and jaxb.impl
src/module-info.java:1: error: module aubin reads package com.sun.xml.bind from both jaxb.core and jaxb.impl
module aubin {
^
87 errors
Я полагаю, что module-info.java не завершен, но я не знаю, как это исправить