我搜索并阅读了maven文档,但没有找到答案。我是java的新手,所以如果这是重复的,请原谅我。
在我们公司的项目中,我看到一个pom定义了这样的元素:
<properties>
<application.main.class>com.xxx.classfoo</application.main.class>
<exec.main.class>com.yyy.classbar</exec.main.class>
...others...
</properties>
所以问题是它们之间有什么区别?他们的名字看起来太像了!
引用maven文档:
Maven属性是值占位符,类似于Ant中的属性。它们的值可以通过使用${X}表示法在POM中的任何位置访问,其中X是属性。
如上所述,它们只是占位符,可以使用${propertyName}引用。
现在可能需要引用由application.main.class
或exec.main.class
定义的类,这就是为什么它们是在项目中定义的,无论在哪里使用,都可以使用${application.main.class}或${exec.main.class}.来引用
这些是专门为您的项目定义的自定义属性-更多信息:https://maven.apache.org/pom.html#properties
试着在pom.xml中搜索${application.main.class}
,你会看到它在中的使用位置