Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inpath project in multimodule project not working #616

Open
Daniel63656 opened this issue Oct 29, 2022 · 1 comment
Open

Inpath project in multimodule project not working #616

Daniel63656 opened this issue Oct 29, 2022 · 1 comment

Comments

@Daniel63656
Copy link

Hi,

I have a .jar file (lets say example.jar) that contains classes to weave as well as an aspect. I want to use this jar in another project. Using intelliJ I achieved this very easily by adding the freefair.aspectj plugin to my build.gradle and adding it by using inpath files.

plugins {
    id 'java'
    id 'io.freefair.aspectj' version '6.4.1'  //compile-time-weaving
}
repositories {
    mavenCentral()
}
dependencies {
    implementation files('libs/example.jar')

    implementation group: 'org.aspectj', name: 'aspectjrt', version: '1.9.6'
    inpath files('libs/example.jar')

    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1'
}
test {
    useJUnitPlatform()
}

The library is in a 'libs' folder. The problem arises when trying to do the same in Android studio where there are multiple projects. When trying to do the same in the build.gradle of my app module, inpath is not recognized at all

Could not find method inpath() for arguments [file collection] on object of type org.gradle.api.internal.artifacts.dsl.dependencies.DefaultDependencyHandler.

How do I configure this to work in a multimodule case? Do I need to put something in the projects build.gradle (currently looks like this

plugins {
    id 'com.android.application' version '7.1.2' apply false
    id 'com.android.library' version '7.1.2' apply false
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

)?

@larsgrefer
Copy link
Member

larsgrefer commented Nov 11, 2022

io.freefair.aspectj does not work for android projects.

There is a separate plugin for this, which you could try:

https://github.com/freefair/android-gradle-plugins/blob/master/examples/aspectj/post-compile/build.gradle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants