Intellij: Confused by "Project data directory must not contain the workspace."

Created on 22 Oct 2017  Â·  19Comments  Â·  Source: bazelbuild/intellij

Let's say there's a simple directory structure:

src/
    my.py
WORKSPACE
BUILD

When importing an existing project, plugin doesn't want to accept "Project data directory" (not sure what it means) to the same location as WORKSPACE file is in:
screenshot from 2017-10-22 11-04-18

Also, setting it to src sub-directory doesn't work either:
screenshot from 2017-10-22 10-56-28

Tried moving WORKSPACE under a directory, but got the first error. It seems that workspace and "project data directory" must not intersect completely.

I'm super confused by this. I would assume that "project data directory" is the root location of the project sources, for example. But then how can bazel workspace not intersect with the sources?

Everything works fine in from bazel command-line.

bazel version: 0.7.0
bazel intellij plugin version: 2017.10.09.0.1

Most helpful comment

Yeah, sorry, I wasn't paying close attention when I wrote that reply and I thought I was replying to an internal Google email. In penance, I'll try to fix this for the Bazel plugin release in threeish weeks.

All 19 comments

The project data directory is where IntelliJ stores its configuration
files, caches, etc. It's not related to your source code and shouldn't be
check into version control, so you don't need it to be in the same
directory as your sources.

On Sun, Oct 22, 2017, 2:53 PM Dzmitry Lazerka notifications@github.com
wrote:

Let's say there's a simple directory structure:

src/
my.py
WORKSPACE
BUILD

When importing an existing project, plugin doesn't want to accept "Project
data directory" (not sure what it means) to the same location as WORKSPACE
file is in:
[image: screenshot from 2017-10-22 11-04-18]
https://user-images.githubusercontent.com/592184/31865008-6e7d0534-b71c-11e7-9e97-af9a06b9e56a.png

Also, setting it to src sub-directory doesn't work either:
[image: screenshot from 2017-10-22 10-56-28]
https://user-images.githubusercontent.com/592184/31865012-7806103c-b71c-11e7-9697-cb8fa7d1360c.png

Tried moving WORKSPACE under a directory, but got the first error. It
seems that workspace and "project data directory" must not intersect
completely.

I'm super confused by this. I would assume that "project data directory"
is the root location of the project sources, for example. But then how can
bazel workspace not intersect with the sources?

Everything works fine in from bazel command-line.

bazel version: 0.7.0
bazel intellij plugin version: 2017.10.09.0.1

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/bazelbuild/intellij/issues/150, or mute the thread
https://github.com/notifications/unsubscribe-auth/AAV7YcDt-PEuzISxyU-cA6pcBz29Br9Tks5su48ygaJpZM4QCDzg
.

Thank you for explaining.

But isn't that the purpose of .gitignore? It's pretty easy to use, I see no problem having IDE-specific files in workspace directory. It has always been like that. Ignoring files was always the default way to omit files from checking in to any version control system, e.g. svn:ignore property or even cvsignore if we want to go 20+ years ago. Maybe I'm missing something, why did it became an issue now?

Also, inevitably there will be a lot of other files not-for-version-control, like bazel-bin, bazel-out etc, if you use Mac OS, there will be .DS_Store or .Thumbs files.

So you recommend having a separate sibling directory, specially for main project directory, like

my-project/
my-project.idea/

?

Just tried that, and had a problem configuring .bazelproject directories:

  • If I include . into directories, it marks the whole project workspace directory as source directory in IDEA. That's wrong, sources are usually put under src/ for Java, C, .Net projects, and app/ for JS projects, for what I know, only Python or small C projects prefer putting sources right into the root.
    That prevents IDEA of correctly recognizing packages for java code, as it now has to be package src.main.java.com.example.myproject; instead of com.example.myproject.
  • If I don't include . to .bazelproject directories, then other project files are not visible from IDEA project structure, (like README.md, WORKSPACE, and all the doc/, lib/, media/, data/ etc directories that usually accompany sources). Project files are not necessarily all sources, but should be visible from IDE.

Also, when I tried to put a BUILD file into the src/main/java/com/example/myproject/mypackage directory (as we used to do in google3), plugin marked com directory as the source root as well. Not sure what's the reasoning there (should be java). If bazel prefers google-internal style directory structure, I wouldn't mind switching to it, just need to know what it is.

Maybe this is a separate issue though.

+1

It would be nice to check in .idea/codeStyleSettings.xml and have IntelliJ automatically pick it up. Right now we have to manually symlink it from our git repo into the Intellij project directory.

Also a pretty strong argument for keeping it in one directory is that all other IntelliJ IDEA language plugins put the project configuration files into the same project directory.

This is really just an internal restriction. I agree the Bazel plugin should allow this -- there's no reason to enforce it in the external plugin, we simply haven't written the code to account for this different use case.

Another reason to fix this is to allow CLI opening of projects.

I have many dozens of possible projects that I use Intellij with. (I've got 10 separate repo clients of our company's main repo, and each one has ~5 different projects that I frequently edit, each is a separate thing in Intellij) Looking through 'recent' projects is a big pain - instead what I like to do is to just cd into the appropriate directory and type 'idea .' For maven projects, this works great. But for Intellij projects, since I have to make the project data directory somewhere else, I have to remember that for those projects, I must cd into that alternate place and open from there. Weird workflow!

Yeah, sorry, I wasn't paying close attention when I wrote that reply and I thought I was replying to an internal Google email. In penance, I'll try to fix this for the Bazel plugin release in threeish weeks.

@brendandouglas Ah, I see. I thought it was a decision, thanks.
@plumpy That's great! Sorry I didn't know it was Bazel's WIP point. Let me know if you need any help.

Good usecase of this is to store coding style and inspection profiles in the repository. I don't like having a separate repo for this.

A fix should be available by the next release.

So now we can have the IntelliJ directory in the code directory?
On Wed, 14 Feb 2018 at 22:13 Chaoren Lin notifications@github.com wrote:

Closed #150 https://github.com/bazelbuild/intellij/issues/150.

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/bazelbuild/intellij/issues/150#event-1474609629, or mute
the thread
https://github.com/notifications/unsubscribe-auth/ABUIF4ujCpUr-CfMZoJ3zw85upVGYVijks5tUz5_gaJpZM4QCDzg
.

Yes, with the next release, the project data location will default to the root of your workspace.

Yay!

Awesome! Well done :)

On Wed, Feb 14, 2018 at 10:50 PM Sean Suchter notifications@github.com
wrote:

Yay!

—
You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/bazelbuild/intellij/issues/150#issuecomment-365740927,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABUIF5OXUa0irixkdGVJWqOwbJ4QHLHQks5tU0cngaJpZM4QCDzg
.

@chaoren: It's actually two releases out, right?

Err. Yes.

So for those of you waiting, it'll be in 2018.02.26, which should be pushed to the plugin repository on about 2018-03-12.

Can the source be synced now?
On Wed, 14 Feb 2018 at 23:50 Michael Plump notifications@github.com wrote:

So for those of you waiting, it'll be in 2018.02.26, which should be
pushed to the plugin repository on about 2018-03-12.

—
You are receiving this because you commented.

Reply to this email directly, view it on GitHub
https://github.com/bazelbuild/intellij/issues/150#issuecomment-365756440,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABUIF0WeXAdvnUpb4hIqvjtxC0sfpRL7ks5tU1UTgaJpZM4QCDzg
.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

KaoruDev picture KaoruDev  Â·  4Comments

stevenleeS0ht picture stevenleeS0ht  Â·  7Comments

cpsauer picture cpsauer  Â·  8Comments

KaoruDev picture KaoruDev  Â·  3Comments

ghost picture ghost  Â·  6Comments