4 Replies Latest reply on Jul 1, 2014 10:33 AM by Mirko Swillus

    How to make one plugin depends on another plugin. Jive 6.

    valery_yahorau

      Hi all
      I want to make one plugin(plugin B) depends on another plugin(plugin A) ?
      I added to pom.xml of plugin A dependency of plugin B:

        <dependency>

           <groupId>com.our.groupId</groupId>

           <artifactId>plugin-B-name</artifactId>

           <version>${project.version}</version>

        </dependency> 

      and also added in plugin.xml of plugin A:

      <dependency>plugin-B-name</dependency>


      After compilation of plugin B, i tried to compile plugin A and always get :

      [ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project plugn-A: Compilation failure: Compilation failure:

      [ERROR] ....java:[5,14] package plugin.B.beans does not exist.

       

      I tried to edit assembly-plugin.xml of plugin B to remove classes folder in jar of this plugin, but have the same compilation error.

       

      Any idea for this issue ? Maybe any-body has working example with dependency between plugins.
      Thanks Valery.

        • Re: How to make one plugin depends on another plugin. Jive 6.
          lkrzyzanek

          Hi, my experience is that you cannot compiles such plugins via maven only because Jive plugin has different architecture. It is JAR but classes is in directory so classic dependency in Maven doesn't work.

          Workaround is import both plugins into Eclipse/Idea and let IDE compile it. Then run mvn package (no compilation is done because classes already exists).

          • Re: How to make one plugin depends on another plugin. Jive 6.
            gdinning

            Before compiling plugin A, did you use mvn clean install to make sure plugin B made it into your .m2 repository?  If you only used compile or package, it will build it in your target directory but won't install it in your repo to be found in other builds.  I've been bit by this before.

             

            Also, you should make sure that the dependency uses <scope>provided</scope>.  You don't want to package plugin B in with plugin A since it will actually be made available at runtime anyway.  Maybe you did but just didn't show the details.

              • Re: How to make one plugin depends on another plugin. Jive 6.
                gdinning

                Was just thinking a bit more about this...

                 

                Do make sure that when you install plugin.A that plugin.B is already installed or there will be problems.  Here, we try to avoid dependencies on plugins to avoid that kind of scenario.  If possible, you might be better off to factor some of the code out of plugin.B into a separate module (module.B) and then make plugin.A and plugin.B dependent on that with <scope>provided</scope>.  Then, add module.B as a dependency in the war project.  Once you mvn clean package the WAR file, it will include your dependencies in module.B and plugins A and B can both be installed independently.

              • Re: How to make one plugin depends on another plugin. Jive 6.
                Mirko Swillus

                Hej Valery Yahorau,

                 

                I just had the same problem and found this thread. I'm currently trying to solve this by packaging "dual use" plugins, so that the jar will contain both: classes filed under /classes for the runtime requirements of jive and furthermore directly under the root of the jar, so it can be used as a direct dependency from maven. So in the end all compiled classes are packaged double, but as far as I can see the size of the packaged jar is not getting twice as big, since the zipper is obviously able to notice that there are files doubled.

                 

                I simply added another fileset to the plugins assembly.xml like so:

                 

                <fileSet>

                        <directory>${project.build.directory}/classes</directory>

                        <outputDirectory>/</outputDirectory>

                </fileSet>

                 

                I did not tested this approach at runtime yet, but I'm confident this will work. Let's see Cheers,

                Mirko