Domanda

I am making a maven project which is trying to run command prompt commands. I tried Exec Maven Plugin but couldn't do it. I think i'm at wrong way for this. Here is my work for making a file with "Exec Maven Plugin". Can someone make an explanation why this is not working or make a suggestion about new plugin or solution which is working at pom.xml (not Ant).

 `<build>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>1.2.1</version>
            <executions>
                <execution>
                    <goals>
                        <goal>exec</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <executable>mkdir</executable>
                <arguments>
                    <argument>C:\Users\USERNAME\Desktop\FILENAME</argument>
                </arguments>
            </configuration>
        </plugin>
    </plugins>
</build>`

Thank You..

È stato utile?

Soluzione

This is just a workaround you can try until someone comes up with a better answer. (I will remove it afterwards probably)

Instead of executing commands directly, you can create a bash/batch script and try to execute that. For example:

<execution>
  <id>Some ID</id>
  <phase>generate-sources</phase>
  <goals>
    <goal>exec</goal>
  </goals>
  <configuration>
    <executable>${basedir}/scripts/do_stuff.sh</executable>
  </configuration>
</execution>

It's basically the same thing, but you can use the normal syntax in the script, instead of the XML syntax in the POM file.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top