【问题标题】:"Either processor or processors need to be given" when running "mvn apt:process"运行“mvn apt:process”时“需要指定一个或多个处理器”
【发布时间】:2012-08-30 01:28:07
【问题描述】:

我正在尝试让 QueryDSL 用于 Spring Roo 项目。

这是我的插件配置:

        <plugin>
            <groupId>com.mysema.maven</groupId>
            <artifactId>maven-apt-plugin</artifactId>
            <version>1.0.2</version>
            <executions>
                <execution>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>process</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>target/generated-sources</outputDirectory>
                        <processor>com.mysema.query.apt.jpa.JPAAnnotationProcessor</processor>
                    </configuration>
                </execution>
            </executions>
        </plugin>

当我运行以下命令时:mvn apt:process,我收到以下错误:

[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building suivitrc 0.1.0.BUILD-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-apt-plugin:1.0.2:process (default-cli) @ suivitrc ---
[ERROR] Either processor or processors need to be given
[ERROR] execute error
java.lang.IllegalArgumentException: Either processor or processors need to be given
        at com.mysema.maven.apt.AbstractProcessorMojo.buildProcessor(AbstractProcessorMojo.java:140)
        at com.mysema.maven.apt.AbstractProcessorMojo.execute(AbstractProcessorMojo.java:157)
        at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:101)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:209)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
        at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:84)
        at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:59)
        at 

    org.apache.maven.lifecycle.internal.LifecycleStarter.singleThreadedBuild(LifecycleStarter.java:183)
            at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:161)
            at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:319)
            at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156)
            at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537)
            at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196)
            at org.apache.maven.cli.MavenCli.main(MavenCli.java:141)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:597)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290)
            at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230)
            at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409)
            at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352)
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 1.375s
    [INFO] Finished at: Wed Sep 05 12:22:16 CEST 2012
    [INFO] Final Memory: 7M/18M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal com.mysema.maven:maven-apt-plugin:1.0.2:process (default-cli) on project suivitrc: Either processor
    to be given -> [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

当然我已经尝试过 mvn install ,它不会生成任何源代码。

欢迎任何建议。

编辑: maven-apt-plugin 的唯一输出是这样的:

[INFO] --- maven-apt-plugin:1.0.2:process (default) @ suivitrc ---

【问题讨论】:

    标签: maven-plugin spring-roo querydsl


    【解决方案1】:

    您直接调用目标。在这种情况下不使用执行配置。运行全新安装时是否遇到同样的异常?

    【讨论】:

    • 不,我在运行全新安装时没有遇到同样的错误。它只是不生成 QueryDsl 类...
    • 嗨蒂莫。我使用mvn clean install 的输出对我的帖子进行了编辑。
    • 你有 JPA 实体注释类吗? Spring Roo 可能会使用其他一些注解。
    • 嗯……其实我也想过。注释位于 .aj (AsjpecJ) 文件中,并在编译时编织。我应该更改插件配置中的阶段吗?如果是,我应该选择哪个阶段?
    • APT 做源代码检查,所以这种方法在这里不起作用。
    猜你喜欢
    • 2020-07-24
    • 2010-09-23
    • 2010-10-18
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-24
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多