小编Esh*_*thu的帖子

无法从 XSD 生成类

这是我用来生成类的 pom.xml。我尝试通过 Maven 构建通过提供目标作为包来生成。我也尝试使用 mvn clean install ,我在控制台中没有看到任何错误,但是,“target/ generated-sources/jaxb”中没有生成任何类

http://maven.apache.org/xsd/maven-4.0.0.xsd">4.0.0

<groupId>com.login.app</groupId>
<artifactId>Login</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>Login</name>
<url>http://maven.apache.org</url>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>3.8.1</version>
        <scope>test</scope>
    </dependency>
</dependencies>


<build>
    <pluginManagement>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>

                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxb2-maven-plugin</artifactId>
            <version>1.5</version>
            <executions>
                <execution>
                    <id>xjc</id>
                    <goals>
                        <goal>xjc</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>

                <outputDirectory>target/generated-sources/jaxb</outputDirectory>
                <packageName>com.login.app</packageName>
                <schemaDirectory>src/main</schemaDirectory>
                <schemaFiles>proto.xsd</schemaFiles>

            </configuration>
        </plugin>

    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

这是我一直在尝试生成 java 类的示例 XSD 文件,如果需要对 xsd 文件进行任何更改,请告诉我。

<xs:element name="UserInfo">
    <xs:complexType>
        <xs:sequence>
            <xs:element name="firsName" type="xs:string" />
            <xs:element name="middleName" type="xs:string" …
Run Code Online (Sandbox Code Playgroud)

java jaxb xjc maven

5
推荐指数
1
解决办法
1万
查看次数

标签 统计

java ×1

jaxb ×1

maven ×1

xjc ×1