【问题标题】:How to pass dependencies for JSR-269 processor to maven-compiler-plugin如何将 JSR-269 处理器的依赖项传递给 maven-compiler-plugin
【发布时间】:2011-10-11 23:26:34
【问题描述】:

我有一个 JSR-269 注释处理器,我试图使用 maven-compiler-plugin 从 Maven 构建中调用它。处理器依赖于 SLF4J 库,但我无法弄清楚如何将其正确传递给编译器插件,以便处理器可以找到它。因此,当它找不到日志绑定时,我会收到标准 SLF4J 错误。

目前我的插件定义如下:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <annotationProcessors>
                    <annotationProcessor>com.mycompany.MyProcessor</annotationProcessor>
                </annotationProcessors>
                <proc>only</proc>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-simple</artifactId>
                    <version>1.6.1</version>
                </dependency>
            </dependencies>
        </plugin>

有人知道怎么做吗?

【问题讨论】:

    标签: maven annotations compilation slf4j processor


    【解决方案1】:

    我认为将 slf4j 添加为普通项目依赖项而不是插件依赖项应该可以在您的设置中使用。或者,您可以使用Maven Annotation Plug-in,它允许将注释处理器(及其依赖项)指定为插件依赖项。

    【讨论】:

      猜你喜欢
      • 2010-11-08
      • 2019-01-25
      • 2011-09-18
      • 1970-01-01
      • 2013-02-17
      • 1970-01-01
      • 2011-09-12
      • 1970-01-01
      • 2013-10-23
      相关资源
      最近更新 更多