Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何让IntelliJ在制作模块时从Maven自动生成JAXB源代码_Maven_Intellij Idea_Jaxb - Fatal编程技术网

如何让IntelliJ在制作模块时从Maven自动生成JAXB源代码

如何让IntelliJ在制作模块时从Maven自动生成JAXB源代码,maven,intellij-idea,jaxb,Maven,Intellij Idea,Jaxb,我有一个Maven项目,它使用JAXB从XSD生成源代码。我想将这个项目作为一个模块导入IntelliJ,并让IntelliJ足够聪明,能够在Make期间生成源代码 my pom.xml的相关块: <build> <plugins> <plugin> <groupId>org.jvnet.jaxb2.maven2</groupId> <artifactId&g

我有一个Maven项目,它使用JAXB从XSD生成源代码。我想将这个项目作为一个模块导入IntelliJ,并让IntelliJ足够聪明,能够在Make期间生成源代码

my pom.xml的相关块:

<build>
    <plugins>
        <plugin>
            <groupId>org.jvnet.jaxb2.maven2</groupId>
            <artifactId>maven-jaxb2-plugin</artifactId>
            <executions>
                <execution>
                    <id>generate-jaxb-content</id>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>generate</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <schemaDirectory>${basedir}/src/main/resources/xsd</schemaDirectory>
                <schemaIncludes>
                    <include>*.xsd</include>
                </schemaIncludes>
            </configuration>
        </plugin>
    </plugins>
</build>

org.jvnet.jaxb2.maven2
maven-jaxb2-plugin
生成jaxb内容
生成源
生成
${basedir}/src/main/resources/xsd
*.xsd
这在命令行中非常有效。但是,当我将项目导入IntelliJ时,它实际上不会生成源代码。我可以通过突出显示XSD并选择
Tools->JAXB->使用JAXB从Xml模式生成Java代码…
手动生成文件,但我希望在选择
makeproject
makemodule
时自动生成。这是因为我有几个使用JAXB的项目,我不想对每个项目都手动执行


这可能吗?

如果您转到设置->构建、执行、部署->编译器->注释处理器,这里有一些设置,用于配置注释处理器,我相信在您执行Make项目或Make模块时,该处理器会运行。我认为IntelliJ应该从pom中获取这些设置,但它可能不会自动执行。另一个选项可能是使用maven运行配置运行generate sources任务。这应根据需要生成适当的来源。