[英]Mark a directory as “Generated Source Root” using command line or using some java or maven code?
I need to mark a directory as "Generated Source Root". 我需要将目录标记为“ Generated Source Root”。 In IntelliJ, or any other GUI tool, it is easy.
在IntelliJ或任何其他GUI工具中,这很容易。 Is there any other way to mark it using command line or using some java or maven code?
还有其他使用命令行或使用某些Java或Maven代码标记它的方法吗?
If you are using maven - build-helper-maven-plugin
does this for you. 如果您使用的是maven,则
build-helper-maven-plugin
会为您执行此操作。 Look at the execution section specifically in the plugin, there you can add you directory under source tag. 查看插件中的执行部分,您可以在源标签下添加目录。
https://www.mojohaus.org/build-helper-maven-plugin/usage.html https://www.mojohaus.org/build-helper-maven-plugin/usage.html
Quoting directly from the link above: 直接从上面的链接报价:
Use this example to add more source directories to your project, since pom.xml only allows one source directory. 使用此示例将更多的源目录添加到您的项目中,因为pom.xml仅允许一个源目录。
<project>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>some directory</source>
...
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.