有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java自己的Maven插件属性在Intellij中标记为“Element..is not allowd here”

我创建了自己的maven插件:

@Mojo(name = "build")
public class InstallerBuilder extends AbstractMojo {

    @Parameter(property = "installerBuilderApplication", required = true)
    private File installerBuilderApplication;

    public void execute() throws MojoExecutionException, MojoFailureException {

        getLog().info("installerBuilderApplication: " + installerBuilderApplication);

        if (!installerBuilderApplication.isFile()) {
            getLog().error("Please ceheck [installerBuilderApplication] argument is correct.");
            throw new MojoExecutionException("Application for installer builder is not a file [" + installerBuilderApplication.getName() + "]");
        }
    }
}

我正在其他maven项目中使用它,如:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <parent>
        <artifactId>company-installer</artifactId>
        <groupId>com.company.lsg</groupId>
        <version>0.0.1-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>

    <artifactId>lsg-installer-builder</artifactId>
    <name>LSG Installer and Patches Build</name>

    <build>
        <plugins>
            <plugin>
                <groupId>com.company.lsg</groupId>
                <artifactId>lsg-installer-maven-plugin</artifactId>
                <version>0.0.1-SNAPSHOT</version>
                <configuration>
                    <installerBuilderApplication>${basedir}/src/installer/builder_app/NSISPortable/App/NSIS/makensis.exe</installerBuilderApplication>
                    <installerBase>C:\LSG\Generic_Installer</installerBase>
                </configuration>
                <executions>
                    <execution>
                        <phase>process-classes</phase>
                        <goals>
                            <goal>build</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <!-- inherits config from parent: can override if required -->
            </plugin>
        </plugins>
    </build>

</project>

在标记参数的地方: enter image description here

Maven软件包很管用,但不知怎的,它让我很困扰

谁能建议我能做些什么来克服这个错误

编辑:我添加了整个pom。xml它是父级的一个模块。Parent只声明了三个模块,并使用maven compile plugin进行了插件管理


共 (0) 个答案