Run .bat file - Maven/Eclipse -
i want run batch file using maven.
my pom.xml looks this:
<project xmlns="http://maven.apache.org/pom/4.0.0" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion> <artifactid>test--clients</artifactid> <packaging>war</packaging> <name>test--clients</name> <parent> <artifactid>test--app</artifactid> <groupid>de.timetoact.test-</groupid> <version>10.0.0</version> </parent> <build> <plugins> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-war-plugin</artifactid> <version>2.4</version> <configuration> <failonmissingwebxml>false</failonmissingwebxml> </configuration> </plugin> <plugin> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-compiler-plugin</artifactid> <version>3.0</version> <configuration> <source>1.6</source> <target>1.6</target> <failonmissingwebxml>false</failonmissingwebxml> </configuration> </plugin> </plugins> </build> <!-- <properties> --> <!-- <maven.compile.source>1.6</maven.compile.source> --> <!-- <maven.compile.target>1.6</maven.compile.target> --> <!-- <failonmissingwebxml>false</failonmissingwebxml> --> <!-- </properties> --> <dependencies> <dependency> <groupid>org.apache.maven.plugins</groupid> <artifactid>maven-antrun-plugin</artifactid> <version>1.8</version> </dependency> <dependency> <groupid>javax.mail</groupid> <artifactid>mail</artifactid> <version>1.4.7</version> </dependency> <dependency> <groupid>org.mockito</groupid> <artifactid>mockito-all</artifactid> <version>1.9.5</version> <scope>test</scope> </dependency> <dependency> <groupid>javax</groupid> <artifactid>javaee-api</artifactid> <version>6.0</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.cloudfoundry</groupid> <artifactid>cloudfoundry-client-lib</artifactid> <version>1.0.2</version> </dependency> <!-- <dependency> --> <!-- <groupid>org.springframework.security.oauth</groupid> --> <!-- <artifactid>spring-security-oauth2</artifactid> --> <!-- <version>1.0.0.release</version> --> <!-- <exclusions> --> <!-- <exclusion> --> <!-- <groupid>org.springframework</groupid> --> <!-- <artifactid>spring-jdbc</artifactid> --> <!-- </exclusion> --> <!-- </exclusions> --> <!-- </dependency> --> <dependency> <groupid>com.ibm.sbt</groupid> <artifactid>com.ibm.commons</artifactid> <version>9.0.0</version> </dependency> <dependency> <groupid>junit</groupid> <artifactid>junit</artifactid> <version>4.8.1</version> <scope>test</scope> </dependency> <dependency> <groupid>commons-fileupload</groupid> <artifactid>commons-fileupload</artifactid> <version>1.3.1</version> </dependency> <dependency> <groupid>de.timetoact.test-</groupid> <artifactid>test--util</artifactid> <version>10.0.0</version> </dependency> <dependency> <groupid>commons-codec</groupid> <artifactid>commons-codec</artifactid> <version>1.9</version> </dependency> </dependencies> <profiles> <profile> <id>test--clients-deploy-eu</id> <build> <plugins> <plugin> <groupid>org.cloudfoundry</groupid> <artifactid>cf-maven-plugin</artifactid> <version>1.1.2</version> <configuration> <server>bluemix</server> <target>https://api.eu-gb.bluemix.net</target> <org>test-</org> <space>test--clients-eu</space> <appname>test--clients</appname> <urls> <url>test--clients.eu-gb.mybluemix.net</url> <url>test--client.eu-gb.mybluemix.net</url> </urls> <memory>192</memory> <services> <service> <name>test-</name> <label>postgresql</label> <plan>100</plan> </service> </services> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>push</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile> <profile> <id>test--dev-deploy-eu</id> <build> <plugins> <plugin> <artifactid>maven-antrun-plugin</artifactid> <version>1.8</version> <executions> <execution> <phase>generate-sources</phase> <configuration> <tasks> <exec dir="${project.basedir}" executable="${project.basedir}/test.bat" failonerror="true"> <arg line="/c" /> </exec> </tasks> </configuration> <goals> <goal>run</goal> </goals> </execution> </executions> </plugin> <plugin> <groupid>org.cloudfoundry</groupid> <artifactid>cf-maven-plugin</artifactid> <version>1.1.2</version> <configuration> <server>bluemix</server> <target>https://api.eu-gb.bluemix.net</target> <org>test-</org> <space>test--dev-eu</space> <appname>test--clients</appname> <urls> <url>test--clients-dev.eu-gb.mybluemix.net</url> <url>test--client-dev.eu-gb.mybluemix.net</url> </urls> <memory>192</memory> <services> <service> <name>test-</name> <label>postgresql</label> <plan>100</plan> </service> </services> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>push</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile> <profile> <id>test--clients-deploy-us</id> <build> <plugins> <plugin> <groupid>org.cloudfoundry</groupid> <artifactid>cf-maven-plugin</artifactid> <version>1.1.2</version> <configuration> <server>bluemix</server> <target>https://api.ng.bluemix.net</target> <org>test-</org> <space>test--clients-us</space> <appname>test--clients</appname> <urls> <url>test--clients.mybluemix.net</url> <url>test--client.mybluemix.net</url> </urls> <memory>192</memory> <services> <service> <name>test-</name> <label>postgresql</label> <plan>100</plan> </service> </services> </configuration> <executions> <execution> <phase>package</phase> <goals> <goal>push</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </profile> </profiles> </project>
what output is:
[info] executing tasks [info] executed tasks
but .bat file has not been called.
tried answers here @ stackoverflow despairing.
what problem here?
you attempting use maven-antrun-plugin
call batch script. if still want check out tutorial run cmd maven ant plugin alternatively can use maven-exec-plugin
run batch script:
<plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>exec-maven-plugin</artifactid> <version>1.2.1</version> <executions> <execution> <phase>generate-sources</phase> <configuration> <executable>cmd</executable> <workingdirectory></workingdirectory> <arguments> <argument>/c</argument> <argument>"${project.basedir}/test.bat"</argument> </arguments> </configuration> <goals> <goal>exec</goal> </goals> </execution> </executions> </plugin>
Comments
Post a Comment