maven pom:application.main.class 和 exec.main.class 之间的区别

maven pom: difference between application.main.class and exec.main.class

我搜索并阅读了 maven docs,但没有找到答案。我是 java 的新手,如果重复请见谅。

在我们公司项目中我看到一个pom定义了这样的元素:

    <properties>
      <application.main.class>com.xxx.classfoo</application.main.class>
      <exec.main.class>com.yyy.classbar</exec.main.class>
      ...others...
    </properties>

所以问题是它们之间有什么区别?他们的名字怎么这么像!

这些是专门为您的项目定义的自定义属性 - 了解更多信息:https://maven.apache.org/pom.html#Properties

尝试在您的 pom.xml 中搜索 ${application.main.class},您会看到它的使用位置

引用自maven docs

Maven properties are value placeholder, like properties in Ant. Their values are accessible anywhere within a POM by using the notation ${X}, where X is the property.

如上所述,它们只是占位符,可以使用 ${propertyName} 进行引用。

现在可能需要引用由 application.main.classexec.main.class 定义的 类 ,这就是它们在属性中定义的原因,无论在哪里使用它们都可以使用${application.main.class} 或 ${exec.main.class}.