spring-gradle-plugins / spring-build-conventions

Contains common build logic and uses conventions to build a Spring Project with Gradle
14 stars 18 forks source link

Add integrationTest.compileClasspath to idea's TEST scope #33

Closed jxblum closed 6 years ago

jxblum commented 6 years ago

Adding the integrationTest classpath configuration to the IDEA module's TEST scope will ensure that anyone building a Gradle-based project (using this Gradle plugin) with IJ will also properly have integrationTest dependencies declared. Otherwise, it is not possible to compile the project in IDEA.

Closes gh-33.

jxblum commented 6 years ago

By way of example, see Spring Session Issue #1163. This PR will fix that issue.

rwinch commented 6 years ago

Thanks for the report @jxblum Integration test dependencies work fine for me with Spring Security. I'm going to wait until the discussion on Spring Session gets resolved.

jxblum commented 6 years ago

Well, Spring Session will build fine with Eclipse (given Spring Build Conventions is complete in this regards, where IJ isn't), but I can assure you, they it will not build with IJ. If you just download IJ 2018.2.1, git clone Spring Session, and try to build it, it will fail as shown here.

This change in Spring Build Conventions will not affect IJ 2018.2, assuming IJ 2018.2 worked in the first place, which it doesn't (certainly not in all cases, i.e. import "Project from Existing Sources" use the Gradle project model, build).

And besides, if users are still on IJ 2017 or earlier, which I was (or according to @vpavic, even IJ < 2018.2, e.g. like 2018.1), then it will be a problem for those users anyway. We cannot expect users to always be using the latest version of their tooling (IJ, Eclipse or otherwise) to build our projects.

rwinch commented 6 years ago

From what I can see it works just fine. I did a fresh clone and ran the integration tests within samples/misc/hazelcast/integration-test without any compilation errors.

We also cannot be expected to work around other tools / libraries bugs (especially when they have fixed the issue in the latest versions).

With that said, I'd like to better understand why you are still having issues before deciding what to do with this issue.

jxblum commented 6 years ago

How is it a bug in the tooling?

Eclipse would not even work properly without this line.

Therefore, this line, that I added in this PR, is the IJ equivalent to Eclipse (line 121).

I don't understand how this possibly could work without manual intervention with IJ, such as excluding the compile or adding the Selenium dependencies as a global library.

Also, it does not count to build the Spring Session project with Gradle inside of IJ. I am talking about exclusively building with IJ and not kicking off any Spring Session build.gradle inside IJ (or in other words, building with Gradle IJ).

rwinch commented 6 years ago

I guess the question is why is this happening? Ever since the conventions plugin was created, I've never seen the problem in IntelliJ with integration tests.

jxblum commented 6 years ago

I have. In all versions of IJ that I have used. And there are only a handful of ways to work around this problem too.

jxblum commented 6 years ago

I used the following (this) as an example of how to fix this issue.

jxblum commented 6 years ago

See comment in Spring Session Issue #1163.

rwinch commented 6 years ago

Thanks for your patience while we tried to fully understand this issue @jxblum! Now that we figured out the problem, I have merged this into master.

jxblum commented 6 years ago

Thank you @rwinch. Much appreciated.

This will help me simplify my configuration of SSDG as well. Currently, to workaround this issue, based on my IDE setup, I have duplicated the integrationTestCompile config with a testCompile too, for example.

rwinch commented 6 years ago

@jxblum This was released as 0.0.18.RELEASE today http://repo.spring.io/plugins-release/io/spring/gradle/spring-build-conventions/0.0.18.RELEASE/

jxblum commented 6 years ago

@rwinch - Sweet! Very excited for this change as I will be able to simply my Gradle build files in SSDG. Thanks again!