gpt4 book ai didi

java - 使用 help-mojo 阶段和 maven-plugin-plugin 编译 Maven 插件

转载 作者:行者123 更新时间:2023-12-01 10:17:11 27 4
gpt4 key购买 nike

我正在开发 MojoHaus plugin 的扩展对于马文来说。我的项目位于this GitHub repository .

当我尝试运行 mvn clean install 时,编译失败并显示以下错误消息:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-plugin-plugin:3.4:helpmojo 
(help-mojo) on project yaml-properties-maven-plugin: Execution help-mojo of goal
org.apache.maven.plugins:maven-plugin-plugin:3.4:helpmojo failed: syntax error @[11,22] in
file:/home/user/workspace/yaml-properties-maven-plugin/src/main/java/org/codehaus/mojo/properties/ResourceType.java -> [Help 1]

ResourceType看起来像:

package org.codehaus.mojo.properties;


import java.util.HashSet;
import java.util.Set;

public enum ResourceType {

PROPERTIES(".properties"),
YAML(new String[]{".yml", ".yaml"});

private final Set<String> fileExtensions;

ResourceType(final String... fileExtensions) {
this.fileExtensions = new HashSet<String>();
for(final String fileExtension: fileExtensions){
this.fileExtensions.add(fileExtension);
}
}

public static Set<String> allFileExtensions(final ResourceType... resourceTypes) {
final Set<String> extensions = new HashSet<String>();
for (final ResourceType resourceType : resourceTypes) {
extensions.addAll(resourceType.fileExtensions());
}

return extensions;
}

public static ResourceType getByFileName(final String fileName) {
for (final ResourceType resourceType : ResourceType.values()) {
for (final String extension : resourceType.fileExtensions()) {
if (fileName.endsWith(extension)) {
return resourceType;
}
}
}

return null;
}

public Set<String> fileExtensions() {
return new HashSet<String>(fileExtensions);
}

}

可能是什么问题?

最佳答案

我认为您遇到了 QDox 的问题,它可能在解析 YAML(new String[]{".yml", ".yaml"}); 行时出现问题。堆栈跟踪可以证实这一点。解决方案实际上非常简单,因为您使用的是 varArgs:将行更改为 YAML(".yml", ".yaml");

关于java - 使用 help-mojo 阶段和 maven-plugin-plugin 编译 Maven 插件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35825646/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com