简体   繁体   中英

Enable exec-maven-plugin while executing jar through java command

I am using exec-maven-plugin to execute a shell script.

                   <executions>
                        <execution>
                            <id>exec-ui-install</id>
                            <phase>generate-sources</phase>

                            <goals>
                                <goal>exec</goal>
                            </goals>
                            <configuration>
                                <executable>bash</executable>
                                <arguments>
                                    <argument>${basedir}/ui-build.sh</argument>
                                </arguments>
                                <skip>${exec.skip}</skip>
                            </configuration>
                        </execution>

                    </executions>

I dont want this to run during build time (as i don't need to run it during build and i am building it from windows). So i am using a parameter named exec.skip and with its help i am able to skip it.

After building jar and moving it to Linux env i am using java command Ex: java -cp : javaclass to run the jar. During this i need to execute "exec-maven-plugin" which was disabled during build mode. How do i pass "exec.skip=true" through java command so that i can run plugin.

You cannot do it.
The maven configuration of a project is used during the build of the project.
Once the artifact/component is constructed, you don't interact any longer with maven.

In your case, you should build your component with the suitable configuration parameters before moving it to linux.

Using a Maven profile with this specific configuration that is launched by a continuous integration tool could ease the task and make it reliable.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM