[英]Can we build a war file of source code using maven command line at a specified directory?
[英]Mark a directory as “Generated Source Root” using command line or using some java or maven code?
我需要將目錄標記為“ Generated Source Root”。 在IntelliJ或任何其他GUI工具中,這很容易。 還有其他使用命令行或使用某些Java或Maven代碼標記它的方法嗎?
如果您使用的是maven,則build-helper-maven-plugin
會為您執行此操作。 查看插件中的執行部分,您可以在源標簽下添加目錄。
https://www.mojohaus.org/build-helper-maven-plugin/usage.html
直接從上面的鏈接報價:
使用此示例將更多的源目錄添加到您的項目中,因為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.