rocker icon indicating copy to clipboard operation
rocker copied to clipboard

Question: maven plugin and m2e Eclipse plugin

Open jknack opened this issue 7 years ago • 10 comments

Rocker maven plugin doesn't work with m2e Eclipse plugin. Is there any workaround?

Thanks.

jknack avatar Mar 17 '17 14:03 jknack

Hi Edgar,

Can you elaborate more on what's not working? Copy-n-paste errors, logs, etc. I'd love to help, but I don't use Eclipse much so w/o more detailed info, I won't be able to assist.

-Joe

On Fri, Mar 17, 2017 at 10:31 AM, Edgar Espina [email protected] wrote:

Rocker maven plugin doesn't work with m2e Eclipse plugin. Is there any workaround?

Thanks.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fizzed/rocker/issues/50, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjwAmmOXj_YBxqKPY8qF-zeeJY_7uihks5rmplbgaJpZM4MgqXI .

jjlauer avatar Mar 17 '17 14:03 jjlauer

Hi @jjlauer

Well I'm kind of new to m2e too (not Eclipse). M2e given me the following error:

Plugin execution not covered by lifecycle configuration: com.fizzed:rocker-maven-plugin:0.16.0:generate (execution: generate-rocker-templates, phase: generate-sources)	pom.xml Maven Project Build Lifecycle Mapping

I successfully used other code generator (usually based on APT) and for example when you recompile something in Eclipse, m2e successfully rerun the plugin and fire/run the maven plugin keeping generated code up-to-date.

This isn't the case for Rocker :(

jknack avatar Mar 17 '17 14:03 jknack

Found it: http://www.eclipse.org/m2e/documentation/m2e-execution-not-covered.html

<build>
    <pluginManagement>
      <plugins>
        <plugin>
          <groupId>org.eclipse.m2e</groupId>
          <artifactId>lifecycle-mapping</artifactId>
          <version>1.0.0</version>
          <configuration>
            <lifecycleMappingMetadata>
              <pluginExecutions>
                <pluginExecution>
                  <pluginExecutionFilter>
                    <groupId>com.fizzed</groupId>
                    <artifactId>rocker-maven-plugin</artifactId>
                    <versionRange>[${rocker.version},)</versionRange>
                    <goals>
                      <goal>generate</goal>
                    </goals>
                  </pluginExecutionFilter>
                  <action>
                    <execute>
                      <runOnIncremental>true</runOnIncremental>
                    </execute>
                  </action>
                </pluginExecution>
              </pluginExecutions>
            </lifecycleMappingMetadata>
          </configuration>
        </plugin>
      </plugins>
    </pluginManagement>
  </build>

jknack avatar Mar 17 '17 15:03 jknack

Oh, sweet, so that was all you need to do? Looks like you actually run an M2E plugin which in turn runs the rocker plugin?

On Fri, Mar 17, 2017 at 11:14 AM, Edgar Espina [email protected] wrote:

Found it: http://www.eclipse.org/m2e/documentation/m2e-execution- not-covered.html

org.eclipse.m2e lifecycle-mapping 1.0.0 com.fizzed rocker-maven-plugin [${rocker.version},) generate true

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fizzed/rocker/issues/50#issuecomment-287381978, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjwAq1DTqw_N6ROBkWOruqNQLXQbUdMks5rmqNHgaJpZM4MgqXI .

jjlauer avatar Mar 17 '17 15:03 jjlauer

It more like a hack. We must provide all the configuration inside pluginManagement (so it never runs from a normal build). Then m2e lookup there and works as a proxy/delegate.

With this, you change a .rocker.html file inside Eclipse and it automatically generate the source code!!!

Another small tweak we need to do is to turn off touchFile. Otherwise, m2e trigger a build and loop forever.

Finally, I'm going to add your excellent library as a jooby module :)

jknack avatar Mar 17 '17 15:03 jknack

I believe you can configure touchFile to be an empty string and that'll disable it. Or you could always set to something non-existent like /dev/null

On Fri, Mar 17, 2017 at 11:28 AM, Edgar Espina [email protected] wrote:

It more like a hack. We must provide all the configuration inside pluginManagement (so it never runs from a normal build). Then m2e lookup there and works as a proxy/delegate.

With this, you change a .rocker.html file inside Eclipse and it automatically generate the source code!!!

Another small tweak we need to do is to turn off touchFile. Otherwise, m2e trigger a build and loop forever.

Finally, I'm going to add your excellent library as a jooby.org module :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fizzed/rocker/issues/50#issuecomment-287385944, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjwAlJrsNKnioW1iJhcypEKjcQToAPhks5rmqaLgaJpZM4MgqXI .

jjlauer avatar Mar 17 '17 15:03 jjlauer

Happy to link to your jooby.org module if/when you publish it.

On Fri, Mar 17, 2017 at 11:30 AM, Joe Lauer [email protected] wrote:

I believe you can configure touchFile to be an empty string and that'll disable it. Or you could always set to something non-existent like /dev/null

On Fri, Mar 17, 2017 at 11:28 AM, Edgar Espina [email protected] wrote:

It more like a hack. We must provide all the configuration inside pluginManagement (so it never runs from a normal build). Then m2e lookup there and works as a proxy/delegate.

With this, you change a .rocker.html file inside Eclipse and it automatically generate the source code!!!

Another small tweak we need to do is to turn off touchFile. Otherwise, m2e trigger a build and loop forever.

Finally, I'm going to add your excellent library as a jooby.org module :)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/fizzed/rocker/issues/50#issuecomment-287385944, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjwAlJrsNKnioW1iJhcypEKjcQToAPhks5rmqaLgaJpZM4MgqXI .

jjlauer avatar Mar 17 '17 15:03 jjlauer

Here is: http://jooby.org/doc/rocker

jknack avatar Mar 26 '17 14:03 jknack

@jknack Added a new section to the README. https://github.com/fizzed/rocker#framework-integrations

jjlauer avatar Mar 27 '17 15:03 jjlauer

@jjlauer In theory you can easily make the rocker maven plugin compatible with m2e (eclipse maven) without requiring library consumers to do the configuration that @jknack did by just following these instructions: https://www.eclipse.org/m2e/documentation/m2e-making-maven-plugins-compat.html#mapping

The m2e plugin basically looks for similar XML to the build section of @jknack pom via a ServiceLocator-like pattern.

agentgt avatar May 01 '19 20:05 agentgt