java - maven pom : difference between application. main.class 和 exec.main.class

标签 java maven pom.xml

我搜索并阅读了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>

那么问题是它们之间有什么区别?他们的名字看起来很相似!

最佳答案

引用自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 定义的类,这就是为什么它们被定义在 proeprties 中以及任何地方要使用它们,可以使用 ${application.main.class} 或 ${exec.main.class} 引用。

关于java - maven pom : difference between application. main.class 和 exec.main.class,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53834431/

相关文章:

java - 帮助我使用通用数据类型

java - 使用 Apache CXF 时,org.bouncycaSTLe.asn1.x509.SubjectPublicKeyInfo 出现 NoClassDefFoundError

java - Spring MVC 上传、生成和下载文件的安全方法

settings.xml 与 pom.xml 中的 Maven 本地存储库

java - "build"如何部署纯文本maven Artifact

java - 无法重新加载 Maven 项目 : Cannot reconnect. java.lang.RuntimeException: 无法重新连接

java - 在生产中定期进行线程转储是否昂贵?

java - NotSerializableException for java.util.Optional with Jackson

java - 如何配置 pom.xml 以在 1 个 Maven 项目中运行 2 个 java 主程序

java - 在 maven 中创建并安装 de-lomboked 源 jar