首页 > 其他分享 >maven常见错误

maven常见错误

时间:2022-10-03 14:03:49浏览次数:58  
标签:xml 错误 常见 maven ERROR apache org resources

  • 错误1:​​maven打包报错​
  • 错误还原:使用maven打包项目时报错如下
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-resources-plugin:3.2.0:resources (default-resources) on project helloworld: Input length = 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
  • 解决方案:配置pom.xml中的maven插件
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.1.0</version>
</plugin>
  • ​参考​
  • 错误2:​​打包项目时报错:maven--Error executing Maven. 2 problems were encountered while building the effective settings​

# 解决方案:settings.xml中标签是否一一对应
<localRepository>E:\apache-maven-3.6.3\repo</localRepository>
<mirrors>
<mirror>
<id>alimaven</id>
<mirrorOf>central</mirrorOf>
<name>aliyun maven</name>
<url>http://maven.aliyun.com/nexus/content/groups/public/</url>
</mirror>
</mirrors>
<profiles>
<profile>
<id>alibaba</id>
<activation>
<activeByDefault>true</activeByDefault>
<jdk>11</jdk>
</activation>
<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.compilerVersion>11</maven.compiler.compilerVersion>
</properties>
</profile>
</profiles>
  • 错误3:​​maven拉取依赖失败,本地仓库中只能下载 .lastUpdate后缀的文件​
错误原因:由于我本地安装了jdk8和jdk14,所以当切换jdk的时候;maven的setting.xml中也需重新配置jdk的版本
解决方案:写一个脚本删除所有 .lastUpdate后缀的文件,重新配置setting.xml后重新拉去依赖
脚本:clearLastUpdated.bat

@echo off
rem create by NettQun
rem 这里写你的仓库路径
set REPOSITORY_PATH=C:\Users\LENOVO\.m2\repository
rem 正在搜索...
for /f "delims=" %%i in ('dir /b /s "%REPOSITORY_PATH%\*lastUpdated*"') do (
echo %%i
del /s /q "%%i"
)
rem 搜索完毕
pause

# 执行完脚本后,重写配置setting.xml,重新拉取依赖



标签:xml,错误,常见,maven,ERROR,apache,org,resources
From: https://blog.51cto.com/chniny/5730199

相关文章