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

Avoid sharing source directories as it breaks intellij #40877

Merged
merged 8 commits into from
Apr 8, 2019

Conversation

mark-vieira
Copy link
Contributor

@mark-vieira mark-vieira commented Apr 4, 2019

This PR includes changes to allow the project to be imported correctly into IntelliJ 2019.1. In this version of IntelliJ a long-standing limitation is now strictly enforced even when importing from Gradle, which is that no two modules can share a single content root. This means that two projects cannot share a source or resource directory, instead we must rely purely on project dependencies for this sort of thing.

For the most part, we were already using project dependencies for this. For projects that depended on test sources from another project the testArtifacts configuration was being used. This works fine when compiling and running unit tests in the IDE, however this breaks down in Gradle because of the way we load certain test resources. Our test fixtures rely on being able to resolve these resources to a filesystem path, which doesn't work if it's embedded in a JAR, which is how Gradle wires up project dependencies by default. We overcome this by simply copying these shared resources to the target projects build directory.

One alternate way to do this might be to leverage Gradle's support for dependency variants and expose a variant which uses the classes and resources output directories instead of a JAR for test dependencies similarly to how the java-library plugin works. This would probably be a more involved change however so to unblock folks to use IntelliJ 2019.1 this seems a reasonable enough workaround.

This PR also removes some unnecessary idea plugin configuration to workaround a Gradle IntelliJ import issue that has since been addressed. This customization of the generated XML project files is the only thing I could see that required the need to run the idea task prior to project import so that requirement has also been removed.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

Copy link
Contributor

@alpar-t alpar-t left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@alpar-t alpar-t merged commit 71d407f into elastic:master Apr 8, 2019
alpar-t pushed a commit that referenced this pull request Apr 8, 2019
* Avoid sharing source directories as it breaks intellij
* Subprojects share main project output classes directory
* Fix jar hell
* Fix sql security with ssl integ tests
* Relax dependency ordering rule so we don't explode on cycles
alpar-t pushed a commit that referenced this pull request Apr 8, 2019
* Avoid sharing source directories as it breaks intellij
* Subprojects share main project output classes directory
* Fix jar hell
* Fix sql security with ssl integ tests
* Relax dependency ordering rule so we don't explode on cycles
@alpar-t alpar-t deleted the intellij-2019-support branch April 8, 2019 15:38
jasontedor added a commit to jasontedor/elasticsearch that referenced this pull request Apr 8, 2019
…e-unsafe-publication

* elastic/master:
  Update contributing docs to reflect JDK 11 (elastic#40955)
  Docs: Simplifying setup by using module configuration variant syntax (elastic#40879)
  Unmute CreateIndexIT testCreateAndDeleteIndexConcurrently CI failures (elastic#40960)
  Revert "Short-circuit rebalancing when disabled (elastic#40942)"
  Mute EnableAllocationShortCircuitTests
  SQL: Refactor args verification of In & conditionals (elastic#40916)
  Avoid sharing source directories as it breaks intellij (elastic#40877)
  Short-circuit rebalancing when disabled (elastic#40942)
  SQL: Prefer resultSets over exceptions in metadata (elastic#40641)
  Mute ClusterPrivilegeTests.testThatSnapshotAndRestore
  Fix Race in AsyncTwoPhaseIndexerTests.testStateMachine (elastic#40947)
  Relax Overly Strict Assertion in TransportShardBulkAction (elastic#40940)
@polyfractal polyfractal added v7.0.1 and removed v7.0.0 labels Apr 9, 2019
mark-vieira added a commit to mark-vieira/elasticsearch that referenced this pull request Apr 9, 2019
mark-vieira added a commit that referenced this pull request Apr 9, 2019
…0877) (#41026)

* Avoid sharing source directories as it breaks intellij (#40877)

(cherry picked from commit 71d407f)
gurkankaymak pushed a commit to gurkankaymak/elasticsearch that referenced this pull request May 27, 2019
* Avoid sharing source directories as it breaks intellij
* Subprojects share main project output classes directory
* Fix jar hell
* Fix sql security with ssl integ tests
* Relax dependency ordering rule so we don't explode on cycles
@mark-vieira mark-vieira added the Team:Delivery Meta label for Delivery team label Nov 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Delivery/Build Build or test infrastructure >non-issue Team:Delivery Meta label for Delivery team v7.0.1 v7.2.0 v8.0.0-alpha1
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants