在Maven中使用配置文件接近于Eclipse提供的运行配置,但并不十分灵活。所以,你可以在你的pom.xml定义您的个人资料
<profiles>
<profile>
<id>Config1</id>
<build>
<plugins>
<plugin>
<!-- create an all-in-one executable jar with maven-shade-plugin bound
to phase:package special handling for spring.handlers/spring.schemas files
to prevent overwriting (maven-shade-plugin joins them to one file) usage:
cd to <project>/target java -jar hello-world-java-1.0-executable.jar spring/batch/job/hello-world-job.xml
helloWorldJob -->
<artifactId>maven-shade-plugin</artifactId>
<version>1.7</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<!-- Added this one because of runtime exception - No container
provider supports the type class org.glassfish.grizzly.http.server.HttpHandler
see - http://stackoverflow.com/questions/9787265/grizzly-and-jersey-standalone-jar -->
<transformer
implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer" />
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.myCompany.nexgen.main.Start</mainClass>
<!-- <mainClass>org.springframework.boot.loader.Launcher</mainClass> -->
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
</transformer>
<transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.schemas</resource>
</transformer>
</transformers>
<shadedArtifactAttached>true</shadedArtifactAttached>
<!-- configures the suffix name for the executable jar here it will
be '<project.artifact>-<project.version>-executable.jar' -->
<shadedClassifierName>executable</shadedClassifierName>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>myLocalrun</id>
<build>
<directory>
c:\sdev\myDev\myProj
</directory>
</build>
</profile>
</profiles>
然后在项目属性点击运行。配置文件的下拉菜单中将列出您的配置文件。您可以在这里创建POM中列出的每个配置文件的参数。
这不是一个完整的答案的问题。很显然,NetBeans缺乏在IDE内快速轻松地切换运行配置的功能,并且这些配置独立于构建工具,并且独立于存储库外部。我附加到不同的数据库,并根据我正在处理的项目的哪些方面使用不同的输入配置。这在NetBeans中非常有限。我不希望将所有运行配置都检入到存储库中,这些配置文件将添加到项目POM中。
[编辑]:所以我几乎在那里的答案上面。点击自定义...按钮,你就可以选择
保持为私有IDE实例
现在这个配置文件/配置不会被保存在POM。实际上它存储在Project Files-nb-configuration.xml中。
建议的解决方案假定使用Ant的时候大部分项目已经转移到Maven的gradle或。 – 2015-12-21 13:50:17
甚至有一个插件可用,运行参数,但它又是基于蚂蚁。寻找与使用的构建工具无关的功能。 http://plugins.netbeans.org/plugin/53855/run-with-arguments – 2017-02-03 16:45:48