Intellij idea Intellij为运行配置设置运行时变量
我有maven run配置,其中我调用:Intellij idea Intellij为运行配置设置运行时变量,intellij-idea,Intellij Idea,我有maven run配置,其中我调用: liquibase:rollback -Dliquibase.rollbackCount=1 -Dliquibase.clearCheckSums=true 有没有办法在运行配置之前显示一些弹出窗口以提供例如回滚计数,而不是编辑配置?没有,但是,您可以使用“复制配置”按钮非常轻松地复制一个配置,然后进行一些类似的配置,并进行所需的更改。尝试以下方法: 在“运行/调试配置”对话框中配置Maven作业 设置复选框显示此页面,如我的屏幕截图所示 调用运行配
liquibase:rollback -Dliquibase.rollbackCount=1 -Dliquibase.clearCheckSums=true
有没有办法在运行配置之前显示一些弹出窗口以提供例如回滚计数,而不是编辑配置?没有,但是,您可以使用“复制配置”按钮非常轻松地复制一个配置,然后进行一些类似的配置,并进行所需的更改。尝试以下方法:
- 在“运行/调试配置”对话框中配置Maven作业
- 设置复选框
,如我的屏幕截图所示显示此页面
- 调用运行配置时,会出现一个对话框,可以编辑字段
或其他内容命令行
IntelliJ本身无法提示您输入命令行参数。但您可以通过解决方法来实现这一点: 1) 创建一个
.bat
文件,提示您输入并创建一个简单的属性文件(假设您使用的是windows)
2) 从maven加载属性文件。这使用了maven的属性插件。如果您已经在使用插件,则不能插入依赖项
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-1</version>
</dependency>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-1</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${basedir}/config.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
org.codehaus.mojo
属性maven插件
1.0-α-1
...
org.codehaus.mojo
属性maven插件
1.0-α-1
初始化
读取项目属性
${basedir}/config.properties
3) 在运行maven之前执行bat
$ProjectFileDir$
并将程序设置为您的.bat
文件在IntelliJ中运行程序时,命令行现在应该打开批处理文件,请求ID。然后将写入属性文件,maven执行并加载该文件。我的回答解决了您的问题吗?如果不是,你到底在寻找什么样的解决方案?
<dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-1</version>
</dependency>
...
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>properties-maven-plugin</artifactId>
<version>1.0-alpha-1</version>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>read-project-properties</goal>
</goals>
<configuration>
<files>
<file>${basedir}/config.properties</file>
</files>
</configuration>
</execution>
</executions>
</plugin>
</plugins>