Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to call maven-antrun-plugin target without attach execution to a maven phase ?

I use maven-antrun-plugin for init config files for my project. But i need to init config files just once, when i first start to init my dev environment, not each time i launch jetty:run.

If I attach phase to process-resouces for example, each time I launch jetty, my config files are reseted.

So i configured antrun like this :

<plugin>
    <artifactId>maven-antrun-plugin</artifactId>
    <executions>
        <execution>
        <goals>
            <goal>run</goal>
        </goals>
        <configuration>
            <target name="init_config_files">
                <!-- init files -->
            </target>
        </configuration>
        </execution>
    </executions>
</plugin>

If I launch mvn antrun:run, it just return me this error : "[INFO] No ant target defined - SKIPPED". And it is the same thing, if I specify target : "mvn antrun:run -Dtarget=init_config_files".

like image 648
Antoine Avatar asked Dec 02 '22 22:12

Antoine


1 Answers

Try this:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-antrun-plugin</artifactId>
            <version>1.7</version>
            <executions>
                <execution>
                    <id>default-cli</id>
                    <configuration>
                        <target>
                            <property name="compile_classpath" refid="maven.compile.classpath" />
                            <echo message="compile classpath: ${compile_classpath}" />
                        </target>
                    </configuration>
                    <goals>
                        <goal>run</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

and run this:

 mvn antrun:run
like image 197
Titi Wangsa Bin Damhore Avatar answered May 11 '23 10:05

Titi Wangsa Bin Damhore