Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/346.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/variables/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何设置-aspectpath“;对于FreeFair AspectJ Gradle插件?_Java_Gradle_Build.gradle_Aspectj_Gradle Plugin - Fatal编程技术网

Java 如何设置-aspectpath“;对于FreeFair AspectJ Gradle插件?

Java 如何设置-aspectpath“;对于FreeFair AspectJ Gradle插件?,java,gradle,build.gradle,aspectj,gradle-plugin,Java,Gradle,Build.gradle,Aspectj,Gradle Plugin,我正在尝试使用库中的AspectJ注释,我正在将它引入我的项目中。我的项目使用Gradle,所以我尝试使用 我需要能够将AspectJ-aspectpath参数设置为Gradle引入的库依赖项 弗里费尔,似乎没有太多,主要是 在他们的示例代码中,我看到我可以使用它将-aspectpath设置为本地“项目”: 有人知道如何将-aspectpath设置为外部库依赖项吗 我创建了一个示例项目并将其放在GitHub: 注意:我使用的是io.freefair.gradle:aspectj插件版本2.9.

我正在尝试使用库中的AspectJ注释,我正在将它引入我的项目中。我的项目使用Gradle,所以我尝试使用

我需要能够将AspectJ-aspectpath参数设置为Gradle引入的库依赖项

弗里费尔,似乎没有太多,主要是

在他们的示例代码中,我看到我可以使用它将-aspectpath设置为本地“项目”:

有人知道如何将-aspectpath设置为外部库依赖项吗

我创建了一个示例项目并将其放在GitHub:

  • 注意:我使用的是io.freefair.gradle:aspectj插件版本2.9.5,因为我的项目使用的是gradle版本4.10.3


更新:我为此创建了一个bug:

方面
是一个普通的gradle配置

这意味着您可以使用此处描述的所有符号:

依赖项{
方面项目(“我的方面”)
方面“com.example.foo:bar方面:1.0.0”
方面文件(“foo.jar”)
}
感谢,他在GitHub问题()中提供了答案

对于io.freefair.aspectj.compile-time-weaving插件2.9.5,配置名为“方面”,而不是“方面”

以下内容解决了该问题:

aspects project(":aspectj:aspect")
完整生成文件类似于:

buildscript {
    repositories {
        maven { url "https://plugins.gradle.org/m2/" }
    }
    dependencies {
        // 2.9.5 for use with Gradle 4.10.3.
        classpath "io.freefair.gradle:aspectj-plugin:2.9.5"
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'

apply plugin: "io.freefair.aspectj.compile-time-weaving"
aspectj.version = '1.9.3'

group 'xyz.swatt'
version '1.0.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {

    ///// SWATT ///// https://mvnrepository.com/artifact/xyz.swatt/swatt
    compile group: 'xyz.swatt', name: 'swatt', version: '1.12.0'
    aspect "xyz.swatt:swatt:1.12.0"
}

你有没有试过在GitHub网站上提出一个问题,并直接询问作者?GitHub罚单不仅仅与bug有关,还可能与文档问题有关。这个插件肯定有一些严重的文档问题
buildscript {
    repositories {
        maven { url "https://plugins.gradle.org/m2/" }
    }
    dependencies {
        // 2.9.5 for use with Gradle 4.10.3.
        classpath "io.freefair.gradle:aspectj-plugin:2.9.5"
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'idea'

apply plugin: "io.freefair.aspectj.compile-time-weaving"
aspectj.version = '1.9.3'

group 'xyz.swatt'
version '1.0.0-SNAPSHOT'

sourceCompatibility = 1.8

repositories {
    mavenCentral()
}

dependencies {

    ///// SWATT ///// https://mvnrepository.com/artifact/xyz.swatt/swatt
    compile group: 'xyz.swatt', name: 'swatt', version: '1.12.0'
    aspect "xyz.swatt:swatt:1.12.0"
}