1.问题描述

利用maven导包,运行Mybatis案例的main函数时报错。

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (default-cli) on project mybatis_annotation: Command execution failed.: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

2.解决办法(三种可参考的方法)

pom.xml中添加以下内容-----exec-maven-plugin

 <build>
        <plugins>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.6.0</version>
<!--                <executions>-->
<!--                    <execution>-->
<!--                        <goals>-->
<!--                            <goal>java</goal>-->
<!--                        </goals>-->
<!--                    </execution>-->
<!--                </executions>-->
                <configuration>
                    <classpathScope>test</classpathScope>
<!--                    <mainClass>com.itheima.test.MybatisTest</mainClass>-->
                </configuration>
            </plugin>
        </plugins>
    </build>

注释部分可以不加

Logo

开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!

更多推荐