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

How to use Gradle for plugin #210

Closed
ashishsoni opened this issue Feb 11, 2016 · 19 comments · Fixed by #367
Closed

How to use Gradle for plugin #210

ashishsoni opened this issue Feb 11, 2016 · 19 comments · Fixed by #367

Comments

@ashishsoni
Copy link

How do i use with gradle for Loggable annotation

@markcerqueira
Copy link

I'm curious about this as well. There is an older issue that also asks about this with some developer follow-up, but no real resolution.

@dmarkov
Copy link

dmarkov commented Feb 16, 2016

@yegor256 please dispatch this issue

@maurcarvalho
Copy link
Contributor

@ashishsoni and @markcerqueira you can set it to weave using iajc.
Maybe we can have a project example page containing packaged projects with diferent build systems like gradle, ant and sbt. What do you think @dmarkov & @yegor256 ?

@bvipparla
Copy link

Any update on this one please. I am trying to use jcabi in my projects but couldn't get through. Suspecting because of the ajc weaver. Can you setup some sample projects using gradle as build tool and working with jcabi

@maurcarvalho
Copy link
Contributor

maurcarvalho commented Jul 10, 2016

@bvipparla I'll do it and place news here asap

@pchmielowski
Copy link

@maurcarvalho - do you have any updates?

@maurcarvalho
Copy link
Contributor

Hello guys, I didn't have the chance to look on it yet 👎
If anyone wants to move forward feel free to jump in.
Regards,
MC

@Arxa
Copy link

Arxa commented Apr 13, 2017

Any updates guys?

@maurcarvalho
Copy link
Contributor

@Arxa looks like no-one is working on it. Feel free to jump for if you wish.

@bilalsha
Copy link

bilalsha commented May 5, 2017

@maurcarvalho will you help me out in setting gradle project example? I can jump to get it working

@sedovalx
Copy link

I've created a simple Gradle version of the plugin https://github.com/sedovalx/gradle-aspectj-binary. Feel free to use it as a sample, fork it or issue a pull request. I had a plan to use it in one of my projects but the command decided not to use aspects, at least for now. Probably it will be helpful for someone anyway.

@maurcarvalho
Copy link
Contributor

maurcarvalho commented May 16, 2017

@sedovalx thanks for your help on it!
There is any chance to create a how-to setup for jcabi-aspects with gradle?

You can document it under Examples > Gradle.
i.e Examples > Ant with AjcTask http://aspects.jcabi.com/example-weaving-ant.html

If you think that it's a good idea, you can fork and PR the example page at jcabi-aspects/src/site/

@maurcarvalho
Copy link
Contributor

@bilalsha take a look at @sedovalx comment. Looks like it's what we needed so far.

@bilalsha
Copy link

https://github.com/bilalsha/gradle-jcabi-example

A sample project to use jcabi-aspect with gradle.

@sedovalx
Copy link

sedovalx commented May 16, 2017

https://github.com/eveoh/gradle-aspectj is definitely a more mature project. But it works with java sources only. In my case it was a downside. But if it is not an issue you'd better stick to the gradle-aspectj plugin.

@sedovalx
Copy link

Anyway here is the setup for the jcabi-aspects with https://github.com/sedovalx/gradle-aspectj-binary.

  1. Add the plugin to the buildscript's classpath.
    buildscript {
      repositories {
        jcenter()
      }
      dependencies {
        classpath "com.github.sedovalx.gradle:gradle-aspectj-binary:$pluginVersion"
      }
    }
  1. Apply plugin in all projects with aspects and annotated classes. In case you don't have your own aspects and use the jcabi-aspects library you need to apply the plugin only in the projects that contain annotated classes.
    apply plugin: 'com.github.sedovalx.gradle-aspectj-binary'
         
    weaveClasses.dependsOn compileJava
    classes.dependsOn weaveClasses
  1. Add jcabi-aspects library to the compile configuration of projects that contain annotated classes.
dependencies {
    compile 'com.jcabi:jcabi-aspects:0.22.6'
    ...
}
  1. Run ./gradlew clean build

That's basically it. Should work with annotated classes and custom aspects written in Java and Kotlin. Not sure about Groovy, Closure and Scala.

@shiziwen
Copy link

@sedovalx Hi, thanks for your contribution, and I use your gradle-aspectj-binary to config jcabi-aspects, it works, but when I build, I got some warn message as below:

WARN:
 * warning build config error: skipping missing, empty or corrupt inpath entry: /Users/tron/Documents/codes/test_retry/build/classes/java/test
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/ImmutabilityChecker.class::0 can not build thisJoinPoint lazily for this advice since it has no suitable guard [Xlint:noGuardForLazyTjp]
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/MethodCacher.class::0 can not build thisJoinPoint lazily for this advice since it has no suitable guard [Xlint:noGuardForLazyTjp]
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/MethodCacher.class::0 can not build thisJoinPoint lazily for this advice since it has no suitable guard [Xlint:noGuardForLazyTjp]
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/MethodScheduler.class::0 can not build thisJoinPoint lazily for this advice since it has no suitable guard [Xlint:noGuardForLazyTjp]
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/MethodScheduler.class::0 can not build thisJoinPoint lazily for this advice since it has no suitable guard [Xlint:noGuardForLazyTjp]
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/MethodValidator.class::0 can not build thisJoinPoint lazily for this advice since it has no suitable guard [Xlint:noGuardForLazyTjp]
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/MethodValidator.class::0 can not build thisJoinPoint lazily for this advice since it has no suitable guard [Xlint:noGuardForLazyTjp]
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/MethodValidator.class::0 can not build thisJoinPoint lazily for this advice since it has no suitable guard [Xlint:noGuardForLazyTjp]
 * warning at tron/test/Main.java:18::0 can not implement lazyTjp on this joinpoint method-execution(java.lang.String tron.test.Main.load()) because around advice is used [Xlint:canNotImplementLazyTjp]
        see also: /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/Repeater.class::0
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/MethodLogger.class::0 advice defined in com.jcabi.aspects.aj.MethodLogger has not been applied [Xlint:adviceDidNotMatch]
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/ImmutabilityChecker.class::0 advice defined in com.jcabi.aspects.aj.ImmutabilityChecker has not been applied [Xlint:adviceDidNotMatch]
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/MethodScheduler.class::0 advice defined in com.jcabi.aspects.aj.MethodScheduler has not been applied [Xlint:adviceDidNotMatch]
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/ExceptionsLogger.class::0 advice defined in com.jcabi.aspects.aj.ExceptionsLogger has not been applied [Xlint:adviceDidNotMatch]
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/MethodValidator.class::0 advice defined in com.jcabi.aspects.aj.MethodValidator has not been applied [Xlint:adviceDidNotMatch]
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/SingleException.class::0 advice defined in com.jcabi.aspects.aj.SingleException has not been applied [Xlint:adviceDidNotMatch]
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/MethodInterrupter.class::0 advice defined in com.jcabi.aspects.aj.MethodInterrupter has not been applied [Xlint:adviceDidNotMatch]
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/QuietExceptionsLogger.class::0 advice defined in com.jcabi.aspects.aj.QuietExceptionsLogger has not been applied [Xlint:adviceDidNotMatch]
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/Parallelizer.class::0 advice defined in com.jcabi.aspects.aj.Parallelizer has not been applied [Xlint:adviceDidNotMatch]
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/MethodAsyncRunner.class::0 advice defined in com.jcabi.aspects.aj.MethodAsyncRunner has not been applied [Xlint:adviceDidNotMatch]
 * warning at /Users/tron/.gradle/caches/modules-2/files-2.1/com.jcabi/jcabi-aspects/0.22.6/a4c2f03f4934a5c4bbb550e4c82c8d12494cbf00/jcabi-aspects-0.22.6.jar!com/jcabi/aspects/aj/MethodCacher.class::0 advice defined in com.jcabi.aspects.aj.MethodCacher has not been applied [Xlint:adviceDidNotMatch]

I have put my test project in https://github.com/shiziwen/test_retry.

How can I remove the warn message?

I found I could writeToLog = true to move the log into another file, but I think I didn't find the solution.

Thank you.

@l3r8yJ
Copy link
Contributor

l3r8yJ commented Jan 15, 2024

i wrote a blog post on this topic

@yegor256 take a look, please
I can send a pull request with instruction (or a link to my blog post) for jcabi site, what do you think?

@0pdd
Copy link

0pdd commented Jul 10, 2024

@ashishsoni the puzzle #391 is still not solved.

l3r8yJ added a commit to l3r8yJ/jcabi-aspects that referenced this issue Jul 10, 2024
yegor256 added a commit that referenced this issue Jul 11, 2024
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

Successfully merging a pull request may close this issue.