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

Packaging executable JARs with plugins

Jordan Salina June 5, 2014

I'm attempting to create a pre-recieve hook plugin which needs to run another jar file on the files being pushed to work. I'm attempting to package said jar with the plugin and then upload and install that to stash. I've verified that my jar is in the plugin jar. (I'm sticking it in the static folder) Here's what my code looks like so far:

public boolean onReceive(RepositoryHookContext context, Collection<RefChange> refChanges,
      HookResponse hookResponse) {
    URI fileURI = null;
    System.out.println("Starting plugin");

    try {
      fileURI = JalopyCheck.class.getProtectionDomain().getCodeSource().getLocation().toURI();
    } catch (URISyntaxException e) {
      e.printStackTrace();
    }

That returns something like "reference:file:/C:/[...stuff...]/target/stash/home/plugins/.osgi-cache/transformed-plugins/[plugin + random numbers].jar" in fileURI. Is there an easier way to grab and run that jar from within the plugin on the file being pushed?

I'm also wondering how to grab the file paths so I can run my jar on them from the command line.

1 answer

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Jordan Salina June 11, 2014

I don't think this is possible. Oh well. I simply installed my program somewhere else on the stash server. Would've been cooler to package it with the plugin, but overly difficult at the same time.

TAGS
AUG Leaders

Atlassian Community Events