Error during delete-project plugin compilation

603 views
Skip to first unread message

Lumír Jasiok

unread,
Aug 16, 2013, 7:50:47 AM8/16/13
to repo-d...@googlegroups.com
Hi, 

I am unable to compile delete-project plugin. I did clone delete-project plugin to the plugins directory, then run command

mvn install:install-file -DgroupId=com.google.gerrit -DartifactId=gerrit-plugin-api -Dversion=2.8-SNAPSHOT -Dpackaging=jar -Dfile=gerrit-plugin-api-2.8-SNAPSHOT.jar -DpomFile=gerrit-plugin-api-2.8-SNAPSHOT.pom

then 

mvn clean install

but I received errors

[ERROR] COMPILATION ERROR :
[INFO] -------------------------------------------------------------
[ERROR] /var/lib/gerrit/appdir/plugins/delete-project/src/main/java/com/google/gerrit/plugins/DeleteProjectCapability.java:[17,42] package com.google.gerrit.extensions.config does not exist
[ERROR] /var/lib/gerrit/appdir/plugins/delete-project/src/main/java/com/google/gerrit/plugins/DeleteProjectCapability.java:[19,45] cannot find symbol
symbol: class CapabilityDefinition
public class DeleteProjectCapability extends CapabilityDefinition {
[ERROR] /var/lib/gerrit/appdir/plugins/delete-project/src/main/java/com/google/gerrit/plugins/DeleteProjectModule.java:[20,42] package com.google.gerrit.extensions.config does not exist
[ERROR] /var/lib/gerrit/appdir/plugins/delete-project/src/main/java/com/google/gerrit/plugins/DeleteProjectCapability.java:[22,2] method does not override or implement a method from a supertype
[ERROR] /var/lib/gerrit/appdir/plugins/delete-project/src/main/java/com/google/gerrit/plugins/DeleteProjectModule.java:[27,9] cannot find symbol
symbol  : class CapabilityDefinition
location: class com.google.gerrit.plugins.DeleteProjectModule
[INFO] 5 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Compilation failure
 
/var/lib/gerrit/appdir/plugins/delete-project/src/main/java/com/google/gerrit/plugins/DeleteProjectCapability.java:[17,42] package com.google.gerrit.extensions.config does not exist
/var/lib/gerrit/appdir/plugins/delete-project/src/main/java/com/google/gerrit/plugins/DeleteProjectCapability.java:[19,45] cannot find symbol
symbol: class CapabilityDefinition
public class DeleteProjectCapability extends CapabilityDefinition {
/var/lib/gerrit/appdir/plugins/delete-project/src/main/java/com/google/gerrit/plugins/DeleteProjectModule.java:[20,42] package com.google.gerrit.extensions.config does not exist
/var/lib/gerrit/appdir/plugins/delete-project/src/main/java/com/google/gerrit/plugins/DeleteProjectCapability.java:[22,2] method does not override or implement a method from a supertype
/var/lib/gerrit/appdir/plugins/delete-project/src/main/java/com/google/gerrit/plugins/DeleteProjectModule.java:[27,9] cannot find symbol
symbol  : class CapabilityDefinition
location: class com.google.gerrit.plugins.DeleteProjectModule


I tried to add repository to the maven using

 <profiles>
    <profile>
      <repositories>
        <repository>
          <snapshots>
            <enabled>true</enabled>
          </snapshots>
          <id>gerrit-api</id>
          <name>Repository for gerrit-api</name>
        </repository>
      </repositories>
    </profile>
  </profiles>
 
in settings.xml but without success.

What am I doing wrong?

Best Regards

Lumir Jasiok

David Pursehouse

unread,
Aug 19, 2013, 2:28:33 AM8/19/13
to Lumír Jasiok, repo-d...@googlegroups.com
On 08/16/2013 08:50 PM, Lumír Jasiok wrote:
> Hi,
>
> I am unable to compile delete-project plugin. I did clone delete-project
> plugin to the plugins directory, then run command
>
> mvn install:install-file -DgroupId=com.google.gerrit
> -DartifactId=gerrit-plugin-api -Dversion=2.8-SNAPSHOT -Dpackaging=jar
> -Dfile=gerrit-plugin-api-2.8-SNAPSHOT.jar
> -DpomFile=gerrit-plugin-api-2.8-SNAPSHOT.pom
>
> then
>
> mvn clean install
>
> but I received errors
>

The delete-project plugin has been updated to use the
CapabilityDefinition that was recently merged on master and should be
exposed in the gerrit-plugin-api JAR file.

It looks like the problem is that Maven doesn't find the JAR file, and
since Maven support has been removed it's not possible to build it locally.

I've added a configuration file for buck in the delete-project plugin
[1] and was able to build the plugin with that.

If you `git fetch && checkout FETCH_HEAD` on the plugin, you should be
able to build it with buck:

$ buck build plugins/delete-project

[1] https://gerrit-review.googlesource.com/#/c/48902/

David Pursehouse

unread,
Aug 19, 2013, 5:23:58 AM8/19/13
to Lumír Jasiok, repo-d...@googlegroups.com, David Ostrovsky
On 08/19/2013 06:07 PM, Lumír Jasiok wrote:
> OK, I have compiled delete-project-2.8-SNAPSHOT.jar inside
> $GERRIT_HOME/appdir/plugins/delete-project directory. I restarted Gerrit
> and think that plugin will be available, but I can't see him.
>
> What else I must do, to enable newly created plugin?
>

I only built it, but didn't actually check that it works.

Just tested now, and on Gerrit startup I can see this in the error log:

> com.google.gerrit.server.plugins.PluginLoader : Cannot load plugin
delete-project

[...]

> This version of the delete-project plugin is not compatible with your
> current schema version (Version: 82)

So it looks like we need to fix something there...

CC David Ostrovsky who probably knows more about this than me...

David Pursehouse

unread,
Aug 19, 2013, 5:26:29 AM8/19/13
to Lumír Jasiok, repo-d...@googlegroups.com, David Ostrovsky, Christian Aistleitner
Sorry, actually that CC should have been Christian Aistleitner.

Lumír Jasiok

unread,
Aug 19, 2013, 5:31:57 AM8/19/13
to repo-d...@googlegroups.com, Lumír Jasiok
OK, I tried to install plugin using plugin install command with following errors:

com.google.gerrit.server.plugins.PluginInstallException: com/google/gerrit/extensions/config/CapabilityDefinition

        at com.google.gerrit.server.plugins.PluginLoader.runPlugin(PluginLoader.java:384)

        at com.google.gerrit.server.plugins.PluginLoader.installPluginFromStream(PluginLoader.java:154)

        at com.google.gerrit.sshd.commands.PluginInstallCommand.run(PluginInstallCommand.java:92)

        at com.google.gerrit.sshd.SshCommand$1.run(SshCommand.java:35)

        at com.google.gerrit.sshd.BaseCommand$TaskThunk.run(BaseCommand.java:429)

        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)

        at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)

        at java.util.concurrent.FutureTask.run(FutureTask.java:166)

        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$101(ScheduledThreadPoolExecutor.java:165)

        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:266)

        at com.google.gerrit.server.git.WorkQueue$Task.run(WorkQueue.java:337)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

        at java.lang.Thread.run(Thread.java:679)

Caused by: java.lang.NoClassDefFoundError: com/google/gerrit/extensions/config/CapabilityDefinition

        at com.googlesource.gerrit.plugins.deleteproject.DeleteProjectModule.configure(DeleteProjectModule.java:27)

        at com.google.inject.AbstractModule.configure(AbstractModule.java:59)

        at com.google.inject.spi.Elements$RecordingBinder.install(Elements.java:223)

        at com.google.inject.spi.Elements.getElements(Elements.java:101)

        at com.google.inject.internal.InjectorShell$Builder.build(InjectorShell.java:133)

        at com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:103)

        at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:217)

        at com.google.inject.internal.InjectorImpl.createChildInjector(InjectorImpl.java:224)

        at com.google.gerrit.server.plugins.Plugin.startPlugin(Plugin.java:204)

        at com.google.gerrit.server.plugins.Plugin.start(Plugin.java:187)

        at com.google.gerrit.server.plugins.PluginLoader.runPlugin(PluginLoader.java:367)

        ... 13 more

Caused by: java.lang.ClassNotFoundException: com.google.gerrit.extensions.config.CapabilityDefinition

        at java.net.URLClassLoader$1.run(URLClassLoader.java:217)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:321)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:266)

        ... 24 more

fatal: plugin failed to install


It's possible, that plugin is compiled against trunk (2.7) version, and I have 2.6.1?


BR


Lumir Jasiok



Dne pondělí, 19. srpna 2013 8:28:33 UTC+2 David Pursehouse napsal(a):

David Pursehouse

unread,
Aug 19, 2013, 5:41:28 AM8/19/13
to Lumír Jasiok, repo-d...@googlegroups.com
On 08/19/2013 06:31 PM, Lumír Jasiok wrote:
> Caused by: java.lang.NoClassDefFoundError:
> com/google/gerrit/extensions/config/CapabilityDefinition
>

> It's possible, that plugin is compiled against trunk (2.7) version, and
> I have 2.6.1?
>
>

The latest version of the plugin will only work the latest version of
Gerrit on the master branch. It will not work with 2.6.x or 2.7.

If you want to use it with 2.6.x or 2.7 you'll need to build it from a
point before the plugin-owned capability functionality
(CapabilityDefinition) was introduced.

The last commit before that is fff69b65384d4c73e375a1fb190102b031cfdbfc
so you could try that.

David Ostrovsky

unread,
Aug 19, 2013, 6:11:57 AM8/19/13
to repo-d...@googlegroups.com, Lumír Jasiok, repo-discuss


On Monday, August 19, 2013 8:28:33 AM UTC+2, David Pursehouse wrote:
On 08/16/2013 08:50 PM, Lumír Jasiok wrote:
> Hi,
>
> I am unable to compile delete-project plugin. I did clone delete-project
> plugin to the plugins directory, then run command
>
> mvn install:install-file -DgroupId=com.google.gerrit
> -DartifactId=gerrit-plugin-api -Dversion=2.8-SNAPSHOT -Dpackaging=jar
> -Dfile=gerrit-plugin-api-2.8-SNAPSHOT.jar
> -DpomFile=gerrit-plugin-api-2.8-SNAPSHOT.pom
>
> then
>
> mvn clean install
>
> but I received errors
>

The delete-project plugin has been updated to use the
CapabilityDefinition that was recently merged on master and should be
exposed in the gerrit-plugin-api JAR file.

It looks like the problem is that Maven doesn't find the JAR file, and
since Maven support has been removed it's not possible to build it locally.


Actually we do support mixed BUCK-Maven build environment for external plugins. We have to do so,
until we add support for BUCK only build for external plugins, without needing to include them in the Gerrit tree.

Pull the latest head for both Gerrit and delete-project-plugin, and you should be able to build the plugin with:

1. cd gerrit && buck build api_install # install the gerrit-plugin-api-2.8-SNAPSHOT.jar into local Maven repository
2. cd ../delete-project-plugin && mvn package # build against newest gerrit-plugin-api with CapabilityDefinition.class

This scenario is documented in dev-buck.txt.

Christian Aistleitner

unread,
Aug 19, 2013, 7:03:31 AM8/19/13
to David Pursehouse, Lumír Jasiok, repo-d...@googlegroups.com, David Ostrovsky
Hi,

On Mon, Aug 19, 2013 at 06:26:29PM +0900, David Pursehouse wrote:
> On 08/19/2013 06:23 PM, David Pursehouse wrote:
> > On 08/19/2013 06:07 PM, Lumír Jasiok wrote:
> > > This version of the delete-project plugin is not compatible with your
> > > current schema version (Version: 82)
> [...]
>
> Sorry, actually that CC should have been Christian Aistleitner.

Thanks for the heads up.
The related change

https://gerrit-review.googlesource.com/#/c/48909/

looks good and should resolve the problem. But I lack permission to +2
for the repository. Added yet another reviewer to the change :-)

Best regards,
Christian


--
---- quelltextlich e.U. ---- \\ ---- Christian Aistleitner ----
Companies' registry: 360296y in Linz
Christian Aistleitner
Gruendbergstrasze 65a Email: chri...@quelltextlich.at
4040 Linz, Austria Phone: +43 732 / 26 95 63
Fax: +43 732 / 26 95 63
Homepage: http://quelltextlich.at/
---------------------------------------------------------------
signature.asc

Lumír Jasiok

unread,
Aug 19, 2013, 8:22:30 AM8/19/13
to repo-d...@googlegroups.com, Lumír Jasiok
It works, thanks a lot.

BR

Lumir Jasiok

Dne pondělí, 19. srpna 2013 11:41:28 UTC+2 David Pursehouse napsal(a):
Reply all
Reply to author
Forward
0 new messages