一些执行maven命令的报错
1.mvn clean --settings ./settings.xml
[ERROR] Could not create local repository at /github/workspace/repository -> [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/LocalRepositoryNotAccessibleException
需要注释掉settings.xml文件中的localRepository配置
<!-- <localRepository>/github/workspace/repository/</localRepository>-->
2.mvn clean
[ERROR] Failed to execute goal on project xxx-build: Could not resolve dependencies for project com.xxx.xxx:xxx-build:pom:1.0.0-SNAPSHOT: The following artifacts could not be resolved: com.xxx.xxx:xxx-server-wdd-engine:jar:1.0.0-SNAPSHOT (absent),com.xxx.xxx:xxx-wdd-engine-connector-influxdb-side:jar:1.0.0-SNAPSHOT (absent): com.xxx.xxx:xxx-server-wdd-engine:jar:1.0.0-SNAPSHOT was not found in https://xxx.xxx.xxx.xxx:8080/artifactory/xxx during a previous attempt. This failure was cached in the local repository and resolution is not reattempted until the update interval of wdd-devops has elapsed or updates are forced -> [Help 1]
需要把pom.xml里面的goals注释掉,暂不清楚什么原因
<build> <plugins> <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-antrun-plugin --> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-antrun-plugin</artifactId> <version>3.0.0</version> <executions> <execution> <id>clean</id> <phase>clean</phase> <goals> <!-- <goal>run</goal> 注释这行,不然mvn clean会报错。但是注释掉再执行mvn clean就不会删打包好的包了--> </goals> <configuration> <target> <delete dir="${project.basedir}/xxxxxxx"/> </target> </configuration> </execution> <execution> <phase>package</phase> <goals> <goal>run</goal> </goals> <configuration> <target> <!----> </target> </configuration> </execution> </executions> </plugin> </plugins> </build>
3.mvn clean package -pl xxxx -am --settings ./settings.xml
Caused by: java.lang.IllegalAccessError: class lombok.javac.apt.LombokProcessor (in unnamed module @0x248b2b61) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) because module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x248b2b61
这个是因为本地的java环境变量没配好,需要jdk1.8版本。
通过java -version查看当前版本
4. mvn clean install -DskipTests
问题1.
[ERROR] org.apache.maven.artifact.InvalidArtifactRTException: For artifact {org.apache.httpcomponents:httpclient:null:jar}: The version cannot be empty.
因为没有指定version,需要在pom.xml文件手动加一下<version>4.5.10</version>
问题2.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.8.0:compile (default-compile) on project xxxxx: Fatal error compiling: java.lang.IllegalAccess Error: class lombok.javac.apt.LombokProcessor (in unnamed module @0x7dbae40) cannot access class com.sun.tools.javac.processing.JavacProcessingEnvironment (in module jdk.compiler) beca use module jdk.compiler does not export com.sun.tools.javac.processing to unnamed module @0x7dbae40 -> [Help 1]
因为升级了springboot版本,lombok版本太低不适配,升级lombok版本即可
问题3.
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.5:clean (default-clean) on project xxxxxxxx: Failed to clean project: Failed to delete C:\Users \xx\Desktop\xxx\xxx\xxxx\xxxx\target\surefire\surefirebooter9494561661287013094.jar
因为这个jar包有进程在使用,所以无法删除,手动删除也不行。需要在cmd执行一下命令,手动kill进程
tasklist | findstr "java" taskkill /F /PID <PID号>
问题4.
Caused by: java.lang.ClassNotFoundException: org.springframework.core.metrics.ApplicationStartup
因为升级了springboot版本,spring-core版本不适配,升级版本即可