In gradle you can achieve it using:
apply plugin: 'enhance'
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath 'org.hibernate:hibernate-gradle-plugin:VERSION'
}
}
dependencies {
compile group: 'org.hibernate.javax.persistence', name: 'hibernate-jpa-[SPEC-VERSION]-api', version: '[IMPL-VERSION]'
compile group: 'org.hibernate', name: 'hibernate-gradle-plugin', version: 'VERSION'
}
What if instead of running the project through Gradle, I want to run my main class directly through Intellij (shift-F10). Is it possible to also perform build-time bytecode instrumentation just before the application run? How should I achieve this?