无法获得公共无参数构造函数

vic*_*ico 5 java eclipse maven

最近我将Paho MQTT Spy 项目导入到 Eclipse 中。导入结束时出错:

building has encouted a problem. An internal error occured during: "Build"

An internal error occurred during: "Building".
com.sun.tools.xjc.Plugin: com.sun.tools.xjc.addon.accessors.PluginImpl Unable to get public no-arg constructor
Run Code Online (Sandbox Code Playgroud)

为什么我会收到这条消息,这意味着什么?如何解决?

我正在使用 Java 13.0.1

我试图mqtt-spy用 maven构建项目并得到同样的错误。

我将下面的依赖项添加到 pom.xml

<dependency>
    <groupId>javax.xml.bind</groupId>
    <artifactId>jaxb-api</artifactId>
    <version>2.2.11</version>
</dependency>
<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-core</artifactId>
    <version>2.2.11</version>
</dependency>
<dependency>
    <groupId>com.sun.xml.bind</groupId>
    <artifactId>jaxb-impl</artifactId>
    <version>2.2.11</version>
</dependency>
<dependency>
    <groupId>javax.activation</groupId>
    <artifactId>activation</artifactId>
    <version>1.1.1</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)

现在 pom.xml 如下所示:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.eclipse.paho.mqttspy</groupId>
    <artifactId>mqtt-spy</artifactId>
    <version>1.0.1-beta</version>
    <packaging>jar</packaging>

    <name>mqtt-spy</name>
    <url>https://github.com/eclipse/paho.mqtt-spy</url>

    <scm>
        <connection>scm:git:../.git</connection>
        <url>../.git</url>
    </scm>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.build.number>${buildNumber}</project.build.number>

        <timestamp>${maven.build.timestamp}</timestamp>
        <maven.build.timestamp.format>yyyy</maven.build.timestamp.format>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>

        <jaxb2.plugin.version>0.12.1</jaxb2.plugin.version>
        <jaxb2.basics.version>0.11.1</jaxb2.basics.version>
    </properties>

    <dependencies>

        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-core</artifactId>
            <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.2.11</version>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>

        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx</artifactId>
            <version>11</version>
            <type>pom</type>
        </dependency>
        <dependency>
            <groupId>org.eclipse.paho.mqttspy</groupId>
            <artifactId>spy-common</artifactId>
            <version>1.0.1</version>
            <exclusions>
                <exclusion>
                    <artifactId>maven-jaxb2-plugin</artifactId>
                    <groupId>org.jvnet.jaxb2.maven2</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.eclipse.paho.mqttspy</groupId>
            <artifactId>spy-common-ui</artifactId>
            <version>1.0.1</version>
            <exclusions>
                <exclusion>
                    <artifactId>maven-jaxb2-plugin</artifactId>
                    <groupId>org.jvnet.jaxb2.maven2</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.eclipse.paho.mqttspy</groupId>
            <artifactId>mqtt-spy-common</artifactId>
            <version>1.0.1</version>
            <exclusions>
                <exclusion>
                    <artifactId>maven-jaxb2-plugin</artifactId>
                    <groupId>org.jvnet.jaxb2.maven2</groupId>
                </exclusion>
            </exclusions>
        </dependency>

        <dependency>
            <groupId>org.apache.maven</groupId>
            <artifactId>maven-artifact</artifactId>
            <version>3.0</version>
        </dependency>

        <!--=== TEST === -->

        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib-nodep</artifactId>
            <version>2.1_3</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.jmock</groupId>
            <artifactId>jmock-legacy</artifactId>
            <version>2.5.1</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.objenesis</groupId>
            <artifactId>objenesis</artifactId>
            <version>1.0</version>
            <scope>test</scope>
        </dependency>

    </dependencies>

    <build>

        <finalName>${project.artifactId}-${project.version}-b${buildNumber}</finalName>

        <!-- Populate version number in the properties file -->
        <resources>
            <resource>
                <directory>src/main/resources</directory>
                <filtering>true</filtering>
                <includes>
                    <include>**/mqtt-spy.properties</include>
                </includes>
            </resource>

            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <excludes>
                    <exclude>**/mqtt-spy.properties</exclude>
                </excludes>
            </resource>

        </resources>

        <plugins>

            <!-- Exclude files -->
            <plugin>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <id>package-client</id>
                        <phase>package</phase>
                        <configuration>
                            <classifier>exclusions</classifier>
                            <excludes>
                                <exclude>**/log4j.properties</exclude>
                            </excludes>
                        </configuration>
                        <goals>
                            <goal>jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Create a runnable jar with all dependencies -->
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>pl.baczkowicz.mqttspy.Main</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <!-- Generate build number -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>1.3</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <doCheck>true</doCheck>
                    <doUpdate>true</doUpdate>
                    <buildNumberPropertiesFileLocation>buildNumber.properties</buildNumberPropertiesFileLocation>
                    <format>{0,number,###}</format>
                    <items>
                        <item>buildNumber</item>
                    </items>
                </configuration>
            </plugin>

            <!-- Generate JAXB clases -->
            <plugin>
                <groupId>org.jvnet.jaxb2_commons</groupId>
                <artifactId>jaxb2-basics</artifactId>
                <version>${jaxb2.basics.version}</version>
            </plugin>
            <plugin>
                <groupId>org.jvnet.jaxb2.maven2</groupId>
                <artifactId>maven-jaxb2-plugin</artifactId>
                <version>${jaxb2.plugin.version}</version>
                <executions>
                    <execution>
                        <id>configuration</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <locale>en</locale>
                            <schemaDirectory>src/main/resources/</schemaDirectory>
                            <schemaIncludes>
                                <include>mqtt-spy-configuration.xsd</include>
                            </schemaIncludes>

                            <!-- Default to the schemaDirectory -->
                            <bindingDirectory>src/main/resources</bindingDirectory>
                            <bindingIncludes>
                                <include>**/mqtt-spy-configuration-bindings.xjb</include>
                            </bindingIncludes>

                            <generateDirectory>src/main/java/</generateDirectory>
                            <generatePackage>pl.baczkowicz.mqttspy.configuration.generated</generatePackage>
                            <removeOldOutput>false</removeOldOutput>

                            <strict>false</strict>
                            <catalogs>
                                <catalog>
                                    <dependencyResource>
                                        <groupId>org.eclipse.paho.mqttspy</groupId>
                                        <artifactId>mqtt-spy-common</artifactId>
                                        <resource>mqtt-spy-common.catalog</resource>
                                    </dependencyResource>
                                </catalog>
                                <catalog>
                                    <dependencyResource>
                                        <groupId>org.eclipse.paho.mqttspy</groupId>
                                        <artifactId>spy-common</artifactId>
                                        <resource>spy-common.catalog</resource>
                                    </dependencyResource>
                                </catalog>
                            </catalogs>

                            <episode>true</episode>
                            <!-- <episodeFile>src/main/java/META-INF/mqtt-spy-configuration.episode</episodeFile> -->

                            <episodes>
                                <episode>
                                    <groupId>org.eclipse.paho.mqttspy</groupId>
                                    <artifactId>mqtt-spy-common</artifactId>
                                </episode>
                                <episode>
                                    <groupId>org.eclipse.paho.mqttspy</groupId>
                                    <artifactId>spy-common</artifactId>
                                </episode>
                            </episodes>

                            <args>
                                <arg>-XtoString</arg>
                                <arg>-Xequals</arg>
                                <arg>-XhashCode</arg>
                                <arg>-Xcopyable</arg>
                                <arg>-Xvalue-constructor</arg>
                            </args>
                            <plugins>
                                <plugin>
                                    <groupId>org.jvnet.jaxb2_commons</groupId>
                                    <artifactId>jaxb2-basics</artifactId>
                                    <version>${jaxb2.basics.version}</version>
                                </plugin>
                            </plugins>
                        </configuration>
                    </execution>

                    <execution>
                        <id>stats</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                        <configuration>
                            <locale>en</locale>
                            <schemaDirectory>src/main/resources/</schemaDirectory>
                            <schemaIncludes>
                                <include>mqtt-spy-stats.xsd</include>

                            </schemaIncludes>

                            <!-- Default to the schemaDirectory -->
                            <bindingDirectory>src/main/resources</bindingDirectory>
                            <bindingIncludes>
                                <include>**/mqtt-spy-stats-bindings.xjb</include>
                            </bindingIncludes>

                            <generateDirectory>src/main/java/</generateDirectory>
                            <generatePackage>pl.baczkowicz.mqttspy.stats.generated</generatePackage>
                            <removeOldOutput>false</removeOldOutput>

                            <episode>false</episode>
                            <!-- <episodeFile>src/main/java/META-INF/mqtt-spy-stats.episode</episodeFile> -->

                            <args>
                                <arg>-XtoString</arg>
                                <arg>-Xequals</arg>
                                <arg>-XhashCode</arg>
                                <arg>-Xcopyable</arg>
                            </args>
                            <plugins>
                                <plugin>
                                    <groupId>org.jvnet.jaxb2_commons</groupId>
                                    <artifactId>jaxb2-basics</artifactId>
                                    <version>${jaxb2.basics.version}</version>
                                </plugin>
                            </plugins>
                        </configuration>
                    </execution>
                </executions>
                <dependencies>
                    <dependency>
                        <groupId>org.jvnet.jaxb2_commons</groupId>
                        <artifactId>jaxb2-value-constructor</artifactId>
                        <version>3.0</version>
                    </dependency>
                </dependencies>
            </plugin>

            <plugin>
                <groupId>com.google.code.maven-replacer-plugin</groupId>
                <artifactId>replacer</artifactId>
                <version>1.5.3</version>
                <executions>
                    <execution>
                        <id>replace</id>
                        <phase>prepare-package</phase>
                        <goals>
                            <goal>replace</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <basedir>${basedir}/src/main/java</basedir>
                    <includes>
                        <include>pl/baczkowicz/mqttspy/configuration/generated/**/*.java</include>
                        <include>pl/baczkowicz/mqttspy/stats/generated/**/*.java</include>
                    </includes>
                    <replacements>
                        <replacement>
                            <token>//${line.separator}// This file was generated by the
                                JavaTM</token>
                            <value>//
                                // Copyright (c) ${maven.build.timestamp} Kamil Baczkowicz
                           

Ale*_*NIS 4

您可能没有使用 JAVA 8。请在项目属性中定义 Java 8 并尝试再次构建它。如果您使用的是 Java9 或更高版本,因为它们放弃了类路径的使用,您需要添加 --add-modules java.xml.bind 作为 JVM 参数,以便连接 mdule