Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to add additional Groovy sources to script execution classpath #66

Open
keeganwitt opened this issue Aug 18, 2016 · 3 comments
Open
Assignees

Comments

@keeganwitt
Copy link
Member

keeganwitt commented Aug 18, 2016

As requested by http://stackoverflow.com/a/39008508/160256.

@keeganwitt keeganwitt self-assigned this Aug 18, 2016
@keeganwitt
Copy link
Member Author

keeganwitt commented Aug 18, 2016

This can't be done by simply adding to the binding, I'll need to use a custom classloader. I'm thinking I'll do this by adding a String parameter to the mojo that could be files or URLs.

@MrAxxy
Copy link

MrAxxy commented Oct 13, 2020

Hello,
anything new about implementing this enhancement? We are considering migration from gmaven-plugin to gmavenplus-plugin and this is holding us back.

@keeganwitt
Copy link
Member Author

keeganwitt commented Oct 15, 2020

I apologize for the crazy long delay. Thinking about this some more, I think this is actually possible today. Though it's a little clunky. Here's what I used as a test.

<execution>
  <id>pre-execute</id>
  <goals>
    <goal>compile</goal>
  </goals>
  <phase>generate-resources</phase>
</execution>
<execution>
  <id>execute</id>
  <goals>
    <goal>execute</goal>
  </goals>
  <phase>process-resources</phase>
  <configuration>
    <scripts>
      <script>
        import com.github.keeganwitt.tests.SomeProjectClass
        println new SomeProjectClass()
      </script>
    </scripts>
  </configuration>
</execution>

mvn clean gplus:compile@pre-execute gplus:execute@execute

I guess one way to make it cleaner would be if I added parameters to call the other goal(s) for you, though I'll have to think about the cleanest way to structure the parameters.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants