我的問題很簡單:我希望maven在資源過濾期間找不到任何屬性時給我一些錯誤消息。
我在官方的maven文檔中找不到任何線索。
那麼我該怎麼做?如何在未找到資源過濾屬性時配置maven資源插件進行投訴?
0
A
回答
1
我建議採取一個能用於這樣的事情maven-enforcer-plugin一個深沉的樣子:
<project>
[...]
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-enforcer-plugin</artifactId>
<version>1.2</version>
<executions>
<execution>
<id>enforce-property</id>
<goals>
<goal>enforce</goal>
</goals>
<configuration>
<rules>
<requireProperty>
<property>basedir</property>
<message>You must set a basedir property!</message>
<regex>.*\d.*</regex>
<regexMessage>The basedir property must contain at least one digit.</regexMessage>
</requireProperty>
<requireProperty>
<property>project.version</property>
<message>"Project version must be specified."</message>
<regex>.*(\d|-SNAPSHOT)$</regex>
<regexMessage>"Project version must end in a number or -SNAPSHOT."</regexMessage>
</requireProperty>
</rules>
<fail>true</fail>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
[...]
</project>
+0
哇...這意味着我希望它所需的所有屬性必須配置在執行目標?這太麻煩了..我想要一種可以向我報告任何遺失財物的方式。 – 2013-03-16 06:28:08
+0
但是哪一個? – khmarbaise 2013-03-16 15:05:35
相關問題
- 1. Maven過濾資源
- 2. Maven資源插件不會過濾Grails項目上的資源
- 3. 如何在使用maven jetty插件時過濾資源?
- 4. maven資源過濾器xml
- 5. 如何在maven中進行簡單的資源過濾?
- 6. 從Maven Plugin爲資源過濾設置pom屬性
- 7. Grails GSP資源插件:資源未找到錯誤
- 8. 使用M2E和外部屬性文件進行Maven資源過濾
- 9. Maven資源過濾不會複製未過濾的文件
- 10. 庫插件::庫資源未找到
- 11. 未找到資源!
- 12. 未找到資源
- 13. 資源文件未找到
- 14. 如何使用maven資源過濾來過濾特定文件
- 15. Maven Assembly插件和資源
- 16. maven WAR插件跳過資源?
- 17. 如何用類路徑資源配置Maven插件?
- 18. 資源插件 - 未找到資源,即使這些文件存在
- 19. 使用run-app運行時未找到Grails插件資源
- 20. 找不到屬性文件 - 如何找到它作爲資源?
- 21. Maven資源與資源
- 22. 找到哪些資源被過濾
- 23. 使用自己的插件進行資源過濾
- 24. 在資源文件中設置屬性
- 25. Maven的:可執行的JAR文件未找到資源
- 26. 在設計時未找到C#資源
- 27. Maven資源過濾器不工作
- 28. 的Maven資源過濾不工作
- 29. android-maven-plugin和資源過濾
- 30. 調試maven junit測試過濾資源?
不幸的是,你不能。請參閱插件參數:http://maven.apache.org/plugins/maven-resources-plugin/copy-resources-mojo.html – 2013-03-15 09:32:11