Plugins Java:Maven在编译的jar中将pom.xml中设置的系统属性存储在哪里?
我们在pom.xml中的maven编译器插件定义中指定了一系列系统属性:Plugins Java:Maven在编译的jar中将pom.xml中设置的系统属性存储在哪里?,plugins,maven,compiler-construction,pom.xml,system-properties,Plugins,Maven,Compiler Construction,Pom.xml,System Properties,我们在pom.xml中的maven编译器插件定义中指定了一系列系统属性: <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <v
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.6</source>
<target>1.6</target>
<encoding>${project.build.sourceEncoding}</encoding>
<systemProperties>
<systemProperty>
<key>aKey</key>
<value>aValue</value>
</systemProperty>
</systemProperties>
<!-- ....etcetera.... -->
当jar被执行时,它们会被自动加载
Maven如何为系统属性创建这种自动加载行为?我想了解这种行为的实际实施。除非我误解了你,否则这不是我所期望的行为。编译时系统属性不应在运行时持久化 我创建了一个基本的maven项目,它只打印出系统属性,不包含插件配置中指定的系统属性 System.getProperties.GetPropertyKey在运行时返回null,即使编译器插件的配置与您的相同
其他运行的插件可能会有影响吗?您是如何访问系统属性的?我们非常确定它确实存在,因为我们有一个项目,它的属性按照我的示例指定,代码在执行jar时将其视为设置为true。搜索项目——实际上是将其变灰——不会显示该关键字的其他实例。我们部署到的环境没有在任何加载的项目文件中定义它。