-
Notifications
You must be signed in to change notification settings - Fork 44
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
Intellij IDEA support #149
Comments
I've just found out support is out there. |
Hi Artemik, Since I haven't used it so far, I didn't include any docs about how to enable PB in IntelliJ IDEA. My question is now, would you be so kind to provide some lines that I can add to the PB documentation, so that a typical IntelliJ user could follow it easy? |
It's not perfect, but I was able to get my build / intellij working with the following added to my Gradle script: apply plugin: 'idea'
ext {
generatedSourcesRoot = "${projectDir}/src/generated-sources/java"
}
compileJava.options.compilerArgs += ['-s', generatedSourcesRoot]
idea.module {
generatedSourceDirs += file(generatedSourcesRoot)
sourceDirs += file(generatedSourcesRoot)
} |
Thank you for this hint. Based on your code snippet I created the following sample project: build.gradleapply plugin: 'idea'
apply plugin: 'java'
ext {
generatedSourcesRoot = "${projectDir}/src/generated-sources/java"
}
compileJava.options.compilerArgs += ['-s', generatedSourcesRoot]
idea {
project {
jdkName = '1.8'
languageLevel = '1.8'
}
module {
generatedSourceDirs += file(generatedSourcesRoot)
sourceDirs += file(generatedSourcesRoot)
}
}
repositories {
mavenCentral()
}
dependencies {
compile 'net.karneim:pojobuilder:4.2.2'
testCompile 'org.assertj:assertj-core:2.8.0'
testCompile 'junit:junit:4.12'
} Then I added the following two classes: src/main/java/sample/Contact.javapackage sample;
import net.karneim.pojobuilder.GeneratePojoBuilder;
@GeneratePojoBuilder
public class Contact {
public String name;
public int age;
} src/test/java/sample/ContactTest.javapackage sample;
import org.junit.Test;
import org.assertj.core.api.Assertions;
public class ContactTest extends Assertions {
@Test
public void test() {
ContactBuilder underTest = new ContactBuilder();
Contact act = underTest.withName("blah").build();
assertThat(act.name).isEqualTo("blah");
}
} Finally I executed When I now invoke "Build > Build Project" I just get the following compile error:
So I guess something is missing :-/ (By the way: building this project from the command line using Gradle works fine.) |
If its still a thing, I put my everyday configs for that in a little example project ;) I use a dedicated sourceset for the generated classes, so it works out of the box for Intellij and eclipse. |
This was a support question and the author never stated they are use Gradle. Should be closed.
|
Is there going to be Intellij IDEA support?
The text was updated successfully, but these errors were encountered: