簡體   English   中英

是否有可能讓maven-jaxb-schemagen-plugin與Java 7一起使用?

[英]Is it possible to get maven-jaxb-schemagen-plugin working with Java 7?

當我嘗試在java 7中使用maven-jaxb-schemagen-plugin

<groupId>com.sun.tools.jxc.maven2</groupId>
<artifactId>maven-jaxb-schemagen-plugin</artifactId>
<version>1.2</version>

我收到一個錯誤:

[ERROR] Failed to execute goal com.sun.tools.jxc.maven2:maven-jaxb-schemagen-plugin:1.2:generate (default) on project TopologyProvisionerDom: Execution default of goal com.sun.tools.jxc.maven2:maven-jaxb-schemagen-plugin:1.2:generate failed: A required class was missing while executing com.sun.tools.jxc.maven2:maven-jaxb-schemagen-plugin:1.2:generate: com/sun/mirror/apt/AnnotationProcessorFactory

似乎在Java 7中刪除/棄用了AnnotationProcessorFactory 有可能讓jaxb schemagen使用這個插件工作嗎? 在使用JDK 7時,是否有另一種方法可以從JAXB源代碼生成模式?

您是否嘗試過使用org.codehaus.mojo:jaxb2-maven-plugin

這是它的工作原理(將此配置文件添加到您的pom.xml ):

<profile>
    <id>jdk7-fix</id>
    <activation>
        <file><exists>${java.home}/../lib/tools.jar</exists></file>
    </activation>
    <build>
        <pluginManagement>
            <plugins>
                <plugin>
                    <groupId>com.sun.tools.jxc.maven2</groupId>
                    <artifactId>maven-jaxb-schemagen-plugin</artifactId>
                    <dependencies>
                        <dependency>
                            <groupId>com.sun</groupId>
                            <artifactId>tools</artifactId>
                            <version>1.7</version>
                            <scope>system</scope>
                            <systemPath>${java.home}/../lib/tools.jar</systemPath>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </pluginManagement>
    </build>
</profile>

不確定是否有人正在聽這個帖子但是,嘿......

我使用了transformSchemas選項,例如

<transformSchemas>
    <transformSchema>
        <uri>YOUR NS IN YOUR GENERATED SCHEMA FILE</uri>
        <toFile>DESIRED NAME OF YOUR XSD FILE</toFile>
    </transformSchema>
</transformSchemas>

干杯

-m。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM