Still unable to import Gerrit into IntelliJ

108 views
Skip to first unread message

Luca Milanesio

unread,
Sep 4, 2019, 3:41:13 PM9/4/19
to Repo and Gerrit Discussion, Luca Milanesio
Hi all,
I am wondering if anyone has been successful in importing Gerrit in IntelliJ 2019.1 after the upgrade to Bazel 0.29.0

I get the following problems:
Error:(22, 1) no such package '@gitiles-servlet//jar': The repository '@gitiles-servlet' could not be resolved and referenced by '//plugins/gitiles:gitiles-servlet-resources'
Error:(4, 1) no such package 'lib/gitiles': BUILD file not found in any of the following directories.
Error:(34, 1) no such package 'lib/gitiles': BUILD file not found in any of the following directories.
... and many others :-(

P.S. I'm using Gerrit on stable-2.16.

Any help is highly appreciated :-)

Luca.

David Pursehouse

unread,
Sep 4, 2019, 8:30:19 PM9/4/19
to Luca Milanesio, Repo and Gerrit Discussion
The errors are related to the gitiles plugin, but you're building stable-2.16 which doesn't have gitiles as a core plugin; it's only in stable-3.0 and master.

Have you switched back from stable-3.0 and the plugins/gitiles folder didn't get cleaned up?  Try manually removing it.

 

Any help is highly appreciated :-)

Luca.

--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/96274B59-CB75-48CC-BCA9-427AD6D3AE5C%40gmail.com.

Luca Milanesio

unread,
Sep 5, 2019, 5:03:22 AM9/5/19
to Repo and Gerrit Discussion, Luca Milanesio

On 5 Sep 2019, at 01:30, David Pursehouse <david.pu...@gmail.com> wrote:

On Thu, Sep 5, 2019 at 4:41 AM Luca Milanesio <luca.mi...@gmail.com> wrote:
Hi all,
I am wondering if anyone has been successful in importing Gerrit in IntelliJ 2019.1 after the upgrade to Bazel 0.29.0

I get the following problems:
Error:(22, 1) no such package '@gitiles-servlet//jar': The repository '@gitiles-servlet' could not be resolved and referenced by '//plugins/gitiles:gitiles-servlet-resources'
Error:(4, 1) no such package 'lib/gitiles': BUILD file not found in any of the following directories.
Error:(34, 1) no such package 'lib/gitiles': BUILD file not found in any of the following directories.
... and many others :-(

P.S. I'm using Gerrit on stable-2.16.

The errors are related to the gitiles plugin, but you're building stable-2.16 which doesn't have gitiles as a core plugin; it's only in stable-3.0 and master.

Have you switched back from stable-3.0 and the plugins/gitiles folder didn't get cleaned up?  Try manually removing it.

Done, however complains in other parts:
/Users/lucamilanesio/gerrithub/gerrit/tools/eclipse/BUILD
Error:(45, 1) no such package 'plugins/codemirror-editor': BUILD file not found in any of the following directories.
Error:(45, 1) no such package 'plugins/commit-message-length-validator': BUILD file not found in any of the following directories.
Error:(45, 1) no such package 'plugins/download-commands': BUILD file not found in any of the following directories.
Error:(45, 1) no such package 'plugins/hooks': BUILD file not found in any of the following directories.
Error:(45, 1) no such package 'plugins/replication': BUILD file not found in any of the following directories.
Error:(45, 1) no such package 'plugins/reviewnotes': BUILD file not found in any of the following directories.
Error:(45, 1) no such package 'plugins/singleusergroup': BUILD file not found in any of the following directories.

The problem I see with the IntelliJ + Bazel plugin approach is that is doing *a different* Bazel build than the one we do in Gerrit
:-(

I am really keen to use it with Gerrit and I saw people successfully adopting it ... however, I still did not figure out why it just doesn't build Gerrit for me :-(

Luca.

Fabio Ponciroli

unread,
Sep 5, 2019, 11:47:07 AM9/5/19
to Luca Milanesio, Repo and Gerrit Discussion
Hi Luca,
I have managed to build the latest version of 2.16 in Intellij with bazel 0.29.0

This is my intellij version:

IntelliJ IDEA 2019.1.4 (Community Edition)
Build #IC-191.8026.42, built on July 29, 2019
JRE: 1.8.0_212-release-1586-b4 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.5

This is what I did (which I guess is the same you did, but just to be sure....):

- clone gerrit 2.16 :)
git submodule update --init --recursive 
- bazel build gerrit
- import bazel project (Generate from BUILD file)

And it worked fine for me. You might wanna try to "Synchronize" the project once imported and give another try.

HTH





Gert van Dijk

unread,
Sep 5, 2019, 12:17:48 PM9/5/19
to Repo and Gerrit Discussion, Luca Milanesio, Fabio Ponciroli
On Thu, Sep 5, 2019 at 5:47 PM Fabio Ponciroli <pon...@gmail.com> wrote:
> [...]
> - clone gerrit 2.16 :)
> - git submodule update --init --recursive
> - bazel build gerrit
> - import bazel project (Generate from BUILD file)

I would recommend you to select from .bazelproject project view file,
instead of "from BUILD file". It contains some configuration for the
Bazel plugin that may be useful.
See also https://gerrit-documentation.storage.googleapis.com/Documentation/3.0.2/dev-intellij.html#_creation_of_the_project

(During GUS2019 I have only tested and verified the new IntelliJ docs
with stable-3.0, but it should just work with stable-2.16 too.)

Per Olausson

unread,
Sep 11, 2019, 10:56:35 AM9/11/19
to Repo and Gerrit Discussion
My current impression is that somehow there are different minimum versions of Java expected depending on the version of Gerrit?

Working on master I don't seem to get it to work with Java8? Is Java9+ mandatory?

If this has changed, where is the cut off? 3.0?

I've tried to build master with Java11 and I can get it to work from both shell bazel builds and Intellij builds, but starting it up dies with:

[2019-09-11 15:47:33,333] [main] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
java.lang.reflect.InaccessibleObjectException: Unable to make public long com.sun.management.internal.OperatingSystemImpl.getProcessCpuTime() accessible: module jdk.management does not "opens com.sun.management.internal" to unnamed module @23c30a20
        at java
.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:340)
        at java
.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280)
...

Trying Java9 workarounds for runtime doesn't seem to work so I am currently stuck here not sure where to go (except perhaps to downgrade to 2.xx.

Gert van Dijk

unread,
Sep 11, 2019, 11:20:38 AM9/11/19
to Per Olausson, Repo and Gerrit Discussion
On Wed, Sep 11, 2019 at 4:56 PM Per Olausson <pol...@gmail.com> wrote:
>
> My current impression is that somehow there are different minimum versions of Java expected depending on the version of Gerrit?
>
> Working on master I don't seem to get it to work with Java8? Is Java9+ mandatory?
>
> If this has changed, where is the cut off? 3.0?
>
> I've tried to build master with Java11 and I can get it to work from both shell bazel builds and Intellij builds, but starting it up dies with:
>
> [2019-09-11 15:47:33,333] [main] ERROR com.google.gerrit.pgm.Daemon : Unable to start daemon
> java.lang.reflect.InaccessibleObjectException: Unable to make public long com.sun.management.internal.OperatingSystemImpl.getProcessCpuTime() accessible: module jdk.management does not "opens com.sun.management.internal" to unnamed module @23c30a20
> at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:340)
> at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:280)
> ...
>
> Trying Java9 workarounds for runtime doesn't seem to work so I am currently stuck here not sure where to go (except perhaps to downgrade to 2.xx.

I have only been successful with Java 8 so far and Gerrit and
IntelliJ. This includes stable branches and master currently.

What I need to do every time is making sure java/javac on my PATH is
java8 (Ubuntu, using update-alternatives):

update-alternatives --config java # select java8
update-alternatives --config javac # select java8
java -version # should return java 8
javac -version # should return java 8

AFAIK all maintainers are all on Java 8 still. However, new stable
Linux distributions don't have Java 8 any longer... (e.g. Debian
Buster)

HTH

Matthias Sohn

unread,
Sep 11, 2019, 11:40:21 AM9/11/19
to Gert van Dijk, Per Olausson, Repo and Gerrit Discussion


--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.

Matthias Sohn

unread,
Sep 11, 2019, 11:55:41 AM9/11/19
to Gert van Dijk, Per Olausson, Repo and Gerrit Discussion

Per Olausson

unread,
Sep 11, 2019, 12:15:28 PM9/11/19
to Repo and Gerrit Discussion

Thanks Gert for your swift reply, I think I must have screwed up the alternatives then. Silly mistake.

So having re-verified that I can build from shell ok, the problem is still that Intellij comes back with a serious helping of warnings/errors.

I noticed now though that "Expand Sync to working set" was enabled. On un-ticking that it seems the errors goes away.

I've not seen that documented anywhere however?

Gert van Dijk

unread,
Sep 11, 2019, 3:59:25 PM9/11/19
to Per Olausson, Repo and Gerrit Discussion
On Wed, Sep 11, 2019 at 6:15 PM Per Olausson <pol...@gmail.com> wrote:
> Thanks Gert for your swift reply, I think I must have screwed up the alternatives then. Silly mistake.
>
> So having re-verified that I can build from shell ok, the problem is still that Intellij comes back with a serious helping of warnings/errors.

Could you please share some of those errors/warnings? There are some
known *warnings* currently
in the latest branch revisions still, which are shown OK, being true
positive ones. However, no *errors*
should show.

> I noticed now though that "Expand Sync to working set" was enabled. On un-ticking that it seems the errors goes away.
>
> I've not seen that documented anywhere however?

That should really not be required to do. It tries to be smart by
validating only files that have been
edited. Do you have a clean working directory Git-wise? Run 'git
status' to see if you have any untracked
files leftover, or submodules not updated, etc.

And what exact revision are you on? Currently stable branches have
issues in combinations of
Bazel(isk) + IntellJ_plugin + IntellJ_version. For now the only way
that compiles for me is:
* IntelliJ 2019.1.x (2019.2.x fails because
https://github.com/bazelbuild/intellij/issues/1161)
* Bazel-IntelliJ plugin version v2019.08.05 (must be very recent to be
compatible with recent Bazel)
* Bazel 0.29.1 (not 1.0.0rc2 as per .bazelversion, because that's
incompatible with v2019.08.05 of
the IntelliJ plugin). If using Bazelisk, update .bazelversion manually:
echo "0.29.1" > .bazelversion

HTH

Per Olausson

unread,
Sep 12, 2019, 3:37:55 AM9/12/19
to Repo and Gerrit Discussion
I wrote that email as I was debugging the build. As soon as I switched off the "Expand Sync to working set" the errors disappeared, so I assume it is some mysterious bazel / bazel intellij plugin problem.

I am guessing I am saw the same issues you raised in 1161 but by flicking that switch I worked around it?

bazel 0.29.0
Intellij Ultimate 2019.2.2
bazel intellij plugin 2019.08.19.0.5

The only modification I have left now is commented out Java9+ settings.

gerrit$ git log -1
commit a8d4b3acad8c4f46ed7d54a0fa0c8fa77a98bcd8 (HEAD -> master, origin/master, origin/HEAD)

   Merge "Report plugins and extensions in metrics"

Matthias Sohn

unread,
Sep 12, 2019, 3:46:50 AM9/12/19
to Per Olausson, Repo and Gerrit Discussion
On Thu, Sep 12, 2019 at 9:37 AM Per Olausson <pol...@gmail.com> wrote:
I wrote that email as I was debugging the build. As soon as I switched off the "Expand Sync to working set" the errors disappeared, so I assume it is some mysterious bazel / bazel intellij plugin problem.

I am guessing I am saw the same issues you raised in 1161 but by flicking that switch I worked around it?

bazel 0.29.0
Intellij Ultimate 2019.2.2
bazel intellij plugin 2019.08.19.0.5

The only modification I have left now is commented out Java9+ settings.

gerrit$ git log -1
commit a8d4b3acad8c4f46ed7d54a0fa0c8fa77a98bcd8 (HEAD -> master, origin/master, origin/HEAD)

   Merge "Report plugins and extensions in metrics"

file a bug for the intellij plugin ?
 
--
--
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.

Per Olausson

unread,
Sep 12, 2019, 1:15:35 PM9/12/19
to Repo and Gerrit Discussion

Matthias, 

I am sympathetic to your suggestion but frankly the less I have to stare down the abyss of bazel the better my well being.

I am sure it might be because I am on a too new version of intellij, but I have noticed that:
  • hotswap doesn't work (bazel or is it gerrit or just me?)
  • building in intellij works, then it stops working and I can't get it work again (give up, go back to command line. It's the 1990s again)
  • building don't seem to take effect, very puzzled
  • when bazel has played up it seems code navigation in intellij is broken - suddenly it doesn't find much - back to find/search/grep (it's the 1980s now)
So, yeah. I am not going to recommend bazel to anyone on the basis of this and I would swap it for anything else had I such luxury.

I recon the "getting started overhead" is 1-2 days and the cycle time waste factor is about 4-5x what it should be with bazel.

Hence I think I am the least suitable candidate to raise any defects with the plugin maintainer. I'll get by as best I can.

Regards,

Per
To unsubscribe, email repo-d...@googlegroups.com

More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-d...@googlegroups.com.

David Ostrovsky

unread,
Sep 12, 2019, 4:13:05 PM9/12/19
to Repo and Gerrit Discussion
I don't use IJ IDEA, but I installed it and tested the integration with different
Bazel versions. I can confirm, that the combination IJ 2019.2.2 + Bazel 0.29.1
works as expected, but IJ 2019.2.2 + Bazel 1.0.0rc2 doesn't. IOW, the
workaround is: downgrade Bazel from 1.0.0rc2 to 0.29.1 in .bazelversion.

I wrote this issue upstream: [1].


Per Olausson

unread,
Sep 12, 2019, 5:02:19 PM9/12/19
to Repo and Gerrit Discussion

David,

Thank you for confirming this, much appreciated. I will give this a go tomorrow! Cheers.

Regards,


Per

Luca Milanesio

unread,
Sep 12, 2019, 5:04:29 PM9/12/19
to Per Olausson, Luca Milanesio, Repo and Gerrit Discussion

On 12 Sep 2019, at 22:02, Per Olausson <pol...@gmail.com> wrote:


David,

Thank you for confirming this, much appreciated. I will give this a go tomorrow! Cheers.

Worst case, there is always the fallback that works *all the times* with IntelliJ:
1) Generate the Eclipse project using:
./tools/eclise/project.py
2) Import Gerrit into IntelliJ as an Eclipse project

For me it is *the only* way to make it work with IntelliJ at the moment :-(

HTH

Luca.


More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/2755c108-1e72-4f91-9484-33b119ea5009%40googlegroups.com.

Per Olausson

unread,
Sep 12, 2019, 5:11:35 PM9/12/19
to Repo and Gerrit Discussion

Ah, that's a really good tip Luca. Cheers for that!!

BTW, what's this wonderful stuff happening in the replication plugin? I am currently poking around there myself so I curious.

More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-d...@googlegroups.com.

Luca Milanesio

unread,
Sep 12, 2019, 5:13:56 PM9/12/19
to Per Olausson, Luca Milanesio, Repo and Gerrit Discussion

On 12 Sep 2019, at 22:11, Per Olausson <pol...@gmail.com> wrote:


Ah, that's a really good tip Luca. Cheers for that!!

BTW, what's this wonderful stuff happening in the replication plugin? I am currently poking around there myself so I curious.

Why don't you come over in November to the Gerrit User Summit 2019 in Sunnyvale and see with your eyes? ;-)

Anyway, yes: lots of fixes and stability improvements. All done because we started using it a lot more in conjunction with the multi-site plugin and we've found lots of bugs and fixed them all.

Luca.


More info at http://groups.google.com/group/repo-discuss?hl=en

---
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/repo-discuss/db45c37f-f2ea-4261-8655-1a0c905e9161%40googlegroups.com.

David Ostrovsky

unread,
Sep 12, 2019, 6:00:13 PM9/12/19
to Repo and Gerrit Discussion
OK, I see what is going on here. I bisected the problem, but then realized,
that it is this incompatible change that leads to the breakage: [1]. Similarly,
to Gerrit itself. But then I figured, that the IntelliJ plugin is already fixed: [2],
but the fix wasn't apparently released yet. Luckily, IntelliJ Bazel plugin is built
with Bazel, so that I conducted intermediate release for IJ 2019.2.2 version: [3].

To install custom plugin version from the disk see this IJ instruction: [4]. With
this plugin version installed Bazel 1.0.0rc2 works as expected with gerrit@HEAD.
This is the content from the Bazel console within IJ IDEA 2019.2.2: [5].


Luca Milanesio

unread,
Sep 12, 2019, 6:03:28 PM9/12/19
to David Ostrovsky, Luca Milanesio, Repo and Gerrit Discussion
Wow, that's amazing !

Why don't you do a lighting talk on the Gerrit on IntelliJ w/ plugin at the forthcoming Gerrit User Summit in Sunnyvale?
;-)

Luca.


-- 
-- 
To unsubscribe, email repo-discuss...@googlegroups.com
More info at http://groups.google.com/group/repo-discuss?hl=en

--- 
You received this message because you are subscribed to the Google Groups "Repo and Gerrit Discussion" group.
To unsubscribe from this group and stop receiving emails from it, send an email to repo-discuss...@googlegroups.com.

Gert van Dijk

unread,
Sep 12, 2019, 6:27:51 PM9/12/19
to David Ostrovsky, Repo and Gerrit Discussion
On Fri, Sep 13, 2019 at 12:00 AM David Ostrovsky
<david.o...@gmail.com> wrote:
> OK, I see what is going on here. I bisected the problem, but then realized,
> that it is this incompatible change that leads to the breakage: [1]. Similarly,
> to Gerrit itself. But then I figured, that the IntelliJ plugin is already fixed: [2],
> but the fix wasn't apparently released yet. Luckily, IntelliJ Bazel plugin is built
> with Bazel, so that I conducted intermediate release for IJ 2019.2.2 version: [3].
>
> To install custom plugin version from the disk see this IJ instruction: [4]. With
> this plugin version installed Bazel 1.0.0rc2 works as expected with gerrit@HEAD.
> This is the content from the Bazel console within IJ IDEA 2019.2.2: [5].
>
> [1] https://github.com/bazelbuild/bazel/issues/7598
> [2] https://github.com/bazelbuild/intellij/commit/5f03bde0f02f5d1693a4567dc129230420a30372
> [3] https://github.com/davido/intellij/releases/tag/intellij-2019.2_bazel-1.0.0
> [4] https://www.jetbrains.com/help/idea/managing-plugins.html#install_plugin_from_disk
> [5] http://paste.openstack.org/show/775518

Thanks! That appears to be working for me as well. Also the NPE seems
to be fixed.
The plugin just needs to be released. :-)

Per Olausson

unread,
Sep 12, 2019, 6:28:32 PM9/12/19
to Repo and Gerrit Discussion

Cool. Well I couldn't come when you were in my home town, so unfortunately Sunnyvale doesn't look easier.

But if did and the gods so wished, I'd be showing you what I have been cooking! :)

Per Olausson

unread,
Sep 13, 2019, 2:55:33 PM9/13/19
to Repo and Gerrit Discussion

Just a brief update. It took a while but it is working for me. 

To get there I went through the following:
  1. David's suggestion: pre-release 1.x bazel, pre-release bazel plugin, latest intellij with origin/master - failed
  2. Luca's suggestion: Eclipse workaround - failed (missing symbols which looked to like Gerrit ones - puzzled). Also then tried stable-3.0. Same result but different moans
  3. Gert's suggestion: bazel 0.29.1, plugin latest released, intellij 2019.1.4 - worked
I believe I did all steps correctly, submodules where updated. JDK versions were checked to be right and so on.

So hope this helps someone out there who might face the same issues.

On Wednesday, 4 September 2019 20:41:13 UTC+1, lucamilanesio wrote:
Reply all
Reply to author
Forward
0 new messages