持续集成之打包配置

1、使用IEDA打包Maven项目

(1)先配置maven的环境变量:

(2)修改maven的conf目录下的 settings.xml,配置本地仓库以及远程仓库【远程仓库为阿里云的,或者使用默认配置】

远程仓库

     <!-- 阿里云仓库-->
    <mirror>
        <id>alimaven</id>
        <mirrorOf>central</mirrorOf>          
        <name>aliyun maven</name>  
        <url>http://maven.aliyun.com/nexus/content/groups/public/</url>     
    </mirror>

(3)配置maven中的jdk信息,并激活配置

(4)POM文件中打包插件的JDK配置信息需maven配置保持一致

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <verbose>true</verbose>
                <fork>true</fork>
                <executable>${JAVA_HOME}/bin/javac</executable>
            </configuration>
        </plugin>
    </plugins>
</build>

(5)常见问题

(5.1)该类问题,可尝试删除maven-compiler-plugin所有的jar包重新下载,或者检查远程仓库是否能访问到 clean、compiler

Error: Plugin org.apache.maven.plugins:maven-clean-plugin:2.5 or one of its dependencies could not b

CoreException: Could not calculate build plan: Plugin org.apache.maven.plugins:maven-compiler-plugin:3.1 or one of its dependencies could not be resolved

(5.2)maven中jdk与打包编译使用jdk没有保持一致

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project ApiAutoTest
190728: Fatal error compiling: 无效的目标发行版: 1.8 -> [Help 1]

发布了17 篇原创文章 · 获赞 0 · 访问量 180

猜你喜欢

转载自blog.csdn.net/qq_37637691/article/details/99663281