Maven: exec-maven-plugin disposed classpathScope

Because the project relies pom file defined scope, it can only be introduced compile and test phase is provided, as follows.

<dependency>
    <groupId>${project.groupId}</groupId>
    <artifactId>atser-common</artifactId>
    <version>${project.parent.version}</version>
    <scope>provided</scope>
</dependency>

The main function performed by calling maven java exec-maven-plugin follows

            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.6.0</version>
                <executions>
                    <execution>
                        <id>pythoncodegenerator</id>
                        <phase>compile</phase>
                        <goals>
                            <goal>java</goal>
                        </goals>
                        <configuration>
                            <mainClass>com.hhasdf.PythonCodeGenerator</mainClass>
                            <arguments>
                                <argument>D:\\testcode\\</argument>
                            </arguments>
                        </configuration>
                    </execution>
                </executions>
            </plugin>

Java.lang.NoClassDefFoundError program will report an error, this is because the java plugin phase, classpath can not find the range is dependent on the level of the jar package provided.

Here the solution of the task to modify the classpath range, modifications to compile life cycle stages: <classpathScope> compile </ classpathScope>

At this point you can not miss it relies friends ~

Problems can also consult the official documentation plugins Address: https://www.mojohaus.org/exec-maven-plugin/index.html , speaking quite detailed.

Guess you like

Origin www.cnblogs.com/xun-meng/p/12158077.html