maven - maven-archetype-plugin 因 ClassNotFoundException 而失败
问题描述
例如,我正在尝试运行 maven-archetype-plugin
mvn org.apache.maven.plugins:maven-archetype-plugin:3.1.1:generate \
-DarchetypeGroupId=org.apache.karaf.archetypes \
-DarchetypeArtifactId=karaf-command-archetype \
-DarchetypeVersion=4.2.6 \
-DgroupId=examples.archetype \
-DartifactId=my-test
但我收到以下错误:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-archetype-plugin:3.1.1:generate
(default-cli) on project standalone-pom: Execution default-cli of goal
org.apache.maven.plugins:maven-archetype-plugin:3.1.1:generate failed:
A required class was missing while executing
org.apache.maven.plugins:maven-archetype-plugin:3.1.1:generate:
org/apache/commons/lang/StringUtils
我尝试了多种原型(开源和专有),但结果总是上面的错误。以前的 maven-archetype-plugin 版本也会产生相同的错误。
我的环境是
- 阿帕奇 Maven 3.6.1
- Java版本:1.8.0_161
- 苹果系统
您知道此问题的任何解决方案或解决方法吗(我已经尝试删除本地存储库文件夹)?
解决方案
我发现可行的解决方案是将 commons-lang 依赖项添加到 maven-archetype-plugin-3.1.2.pom
您可以在您的 maven 存储库 C:\Users\your_user\.m2\repository\org\apache\maven\plugins\maven-archetype-plugin\3.1.2\maven- 中找到 maven-archetype-plugin-3.1.2.pom原型插件3.1.2.pom
然后将 commons-lang 添加到依赖项中。
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>2.3</version>
</dependency>
希望能帮助到你。
推荐阅读
- python - 使用不同的默认值集解析 args
- docusignapi - 多个帐户的 Docusign 共享集成密钥
- python - django.db.migrations.exceptions.NodeNotFoundError:迁移accounts.0001_initial依赖项引用不存在的父节点
- reactjs - 用反应状态反应动态表单
- c - 为什么我的程序不接受减法?
- salesforce - azure 数据工厂 - 销售人员查找
- typescript - 使用 TypeScript 和 Emotion 设计 Reach UI
- javascript - 返回最短和最长单词的长度之差(使用 for 循环)
- ios - SwiftUI:使用 MFMailComposeViewController 发送电子邮件
- java - 当用户打开某个应用程序时启动我的应用程序 - Android