Intellij set runtime variables for run configuration -
i have maven run configuration, call:
liquibase:rollback -dliquibase.rollbackcount=1 -dliquibase.clearchecksums=true
is there way display popup provide instance rollbackcount before running configuration instead of editing configuration?
intellij can't prompt commandline parameters. can achieve workaround:
1) create .bat
file prompts input , creates simple properties file (assuming you're using windows)
@echo off set /p id="id: " echo liquibase.rollbackcount=%id% > config.properties
2) load properties file maven. uses properties plugin maven. if you're using plugin dependency must not inserted.
<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>
3) execute bat before running maven
- edit run configuration
- add "external tool" "before launch"
- set working directory to:
$projectfiledir$
, program.bat
file
when running program in intellij commandline should open batch file asking id. properties file written, maven executes , loads file.
Comments
Post a Comment