Reputation: 17713
I'm working on an extension of a MojoHaus plugin for Maven. My project is at this GitHub repository.
When I try to run mvn clean install
, the compilation fails with the following error message:
[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]
The class ResourceType
looks like:
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);
}
}
What could be the issue?
Upvotes: 0
Views: 349
Reputation: 12345
I think you're hitting an issue with QDox, which probably has an issue with parsing the line YAML(new String[]{".yml", ".yaml"});
. The stacktrace can confirm that.
The solution is actually quite simple since you're using varArgs: change the line to YAML(".yml", ".yaml");
Upvotes: 1