Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Compile Groovy classes in plugin

Rakesh Vidyadharan September 26, 2011

Hello,

I will be starting a custom project that involves adding quite a lot of custom features to our JIRA installation. I went through the plugin SDK documents and got some proof of concept screens with some of the types of integrations we need working. The next step before we start developing the actual set of plugins is to see how to write the sources (servlets, custom field, etc) as groovy classes and get those compiled and included in the plugin. I have seen answeres related to using the Groovy Script runner plugin to execute scripts, but I am not sure if that is what we really need. I would prefer to compile the Groovy classes using groovyc and then bundle the complled classes into our plugin jar file.

Any hints or links to documentation would be highly appreciated.

I could of course try and write my own Ivy/Ant scripts that will compile the plugin jar file, but am not sure of how to integrate that into the maven based scripts that come with the SDK.

Thanks in advance for all help and suggestions

Rakesh

4 answers

1 accepted

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Answer accepted
Rakesh Vidyadharan October 6, 2011

I developed my own ivy/ant buld system.

Rakesh Vidyadharan October 6, 2011

See http://sptci.com/docs/java/jira.html for the build scripts.

1 vote
Dimitar Dimitrov October 7, 2011

Did you try to configure the GMaven Maven plugin? It should all just work, as Groovy produces regular class files. You would also need to declare dependency on the groovy runtime. Let me know if you need more details:

http://docs.codehaus.org/display/GMAVEN/Building+Groovy+Projects

0 votes
Erik Mason May 28, 2015

We got it to compile during atlas-run just fine with these pom settings:

<build>
  <sourceDirectory>src/main/groovy</sourceDirectory>
  <testSourceDirectory>src/test/groovy</testSourceDirectory>
  <plugins>
    <plugin>
      <groupId>org.apache.maven.plugins</groupId>
      <artifactId>maven-compiler-plugin</artifactId>
      <version>3.2</version>
      <configuration>
        <compilerId>groovy-eclipse-compiler</compilerId>
        <source>1.7</source>
        <target>1.7</target>
      </configuration>
      <dependencies>
        <dependency>
          <groupId>org.codehaus.groovy</groupId>
          <artifactId>groovy-eclipse-batch</artifactId>
          <version>2.3.4-01</version>
        </dependency>
        <dependency>
          <groupId>org.codehaus.groovy</groupId>
          <artifactId>groovy-eclipse-compiler</artifactId>
          <version>2.9.0-01</version>
        </dependency>
      </dependencies>
    </plugin>
    <plugin>
      <groupId>org.codehaus.groovy</groupId>
      <artifactId>groovy-eclipse-compiler</artifactId>
      <version>2.7.0-01</version>
      <extensions>true</extensions>
    </plugin>
    <plugin>
      <groupId>com.atlassian.maven.plugins</groupId>
      <artifactId>maven-amps-plugin</artifactId>
      <version>${amps.version}</version>
      <extensions>true</extensions>
      <configuration>
        <productVersion>${amps.version}</productVersion>
        <allowGoogleTracking>false</allowGoogleTracking>
        <useFastdevCli>false</useFastdevCli>
      </configuration>
    </plugin>
  </plugins>
</build>

 

However, when we try to run atlas-cli and the "pi" command we get:

[ERROR] Unable to complete running command: pi
java.lang.RuntimeException: org.apache.maven.plugin.MojoExecutionException: Unable to execute mojo
 ...
Caused by: org.apache.maven.plugin.MojoExecutionException: Unable to execute mojo
 ...
Caused by: org.apache.maven.plugin.MojoExecutionException: No such compiler 'groovy-eclipse-compiler'.
 ...

Sorry for the wall of text, but we can't seem to find a solution to make this work. We'd like to use atlas-cli so that we don't have to restart our local JIRA every time we make a Groovy/XML change. Any help would be greatly appreciated.

 

0 votes
Jim Bethancourt
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 21, 2012

As an FYI to all considering writing a Groovy-based plugin, I ran into PermGen OutOfMemoryExceptions after deploying several times with Groovy-all embedded in my plugin. While this can be coped with in a development environment, it would have larger implications in a production environment and could cause headaches. Proceed with caution.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events