groovy / GMavenPlus

A rewrite of GMaven, a Maven plugin for Groovy
Other
285 stars 35 forks source link

Gmaven migration wiki article is not actually telling me how to migrate from gmaven #228

Closed FieteO closed 2 years ago

FieteO commented 2 years ago

I have seen that you have a GMaven Migration wiki article. My expectation before reading it was that it would tell me whether this would be a completely drop-in replacement and if not, what would be needed to change in terms of configuration coming from gmaven.

However, the article is basically evaluating different choices of plugins a user may consider to get Groovy into his project. This is very informative to understand what this plugin does and does not offer, but it would be great if the article could also describe the steps needed once a user has made that decision (for this plugin).

keeganwitt commented 2 years ago

The Examples page covers a lot of use cases. I added two of the most popular use cases to the migration page. Does this help? Anything else you think would be useful to add?

FieteO commented 2 years ago

Thanks for the quick response! That is indeed helpful.

Even though it would require less mental transfer if the configurations were on the same page and really describing the same thing. One gotcha for me in particular was that groovy code is not in

<configuration>
  <source>
    <!-- code here -->
  </source>
</configuration>

but in

<scripts>
  <script>
    <!-- code here -->
  </script>
</scripts>

So in particular for the Running scripts section (also theres a typo Runing) I would replace the With the one documented here with

<build>
  <plugin>
    <groupId>org.codehaus.gmavenplus</groupId>
    <artifactId>gmavenplus-plugin</artifactId>
    <version>1.13.1</version>
    <scripts>
      <script>
        println 'Hi!'
      </script>
    </scripts>
  </plugin>
</build>

to have a clear diff of what needs to be changed. Also the Compiling example that is linked to the Joint Compilation makes me wonder whether the maven-compiler-plugin and the groovy-all dependency are (always) necessary to get the same thing as with the gmaven-plugin, or if they actually are not relevant at all when looking at this from the migration perspective...

keeganwitt commented 2 years ago

Even though it would require less mental transfer if the configurations were on the same page and really describing the same thing.

I thought about that, but didn't love the idea of maintaining two pages of the same example. I'll give this some more thought.

makes me wonder whether the maven-compiler-plugin and the groovy-all dependency are (always) necessary to get the same thing as with the gmaven-plugin, or if they actually are not relevant at all when looking at this from the migration perspective...

You need some kind of groovy dependency, not necessarily groovy-all. GMaven had the concept of a "provider" (which you might have seen), which would be the version it used for compiling, but if this was different than your dependency version, your runtime version might not match, which was confusing. With GMavenPlus, whatever version you declare as a dependency is the one it will use. groovy-all gives access to all parts of Groovy and so was the simplest for the sake of an example.

The compiler-plugin reference is not mandatory typically, as it is part of the default lifecycle. I included it since it's a best pratice to specify the version rather than relying on the version coming from your version of Maven and to show if you are using a different lifecycle that that plugin will need to be part of it.

FieteO commented 2 years ago

Thanks for the explanations.

Personally I think there is still some room for improvement on the document, but I am glad that there is now something in it to get you starter when migrating.