Sculptor: New Maven Plugin

已查看 122 次
跳至第一个未读帖子

Torsten Juergeleit

未读,
2012年1月11日 07:04:282012/1/11
收件人 fornax-...@googlegroups.com
We ran into the same classpath issue as Ron [1] with projects using dependencies which require newer versions of Google libraries (Collections / Guava, Guice) than the ones used by Sculptors code generator (Xtext 1 uses Google Collection 0.8 and Google Guice 2.0). So we badly need a way to get rid of Sculptors code generator library from our project dependencies. The suggested approach of moving the Sculptor code generation to a separate project is a no-go for us. We have to many fine-grained projects which are using Sculptors code generator.

So I started to implement a new Maven plugin for Sculptors code generator based on the code of the fornax-oaw-m2-plugin. The main design goals are as follows:

  * no project dependencies - the Sculptor code generator library (with its Xtext dependencies) is retrieved from the plugin dependencies instead

  * no Java Ant task for running a JVM - commons-exec is used instead

  * all resources used by the code generator (*.btdesign, worflow descriptor, generator properties, transformation/template advices) reside within the same Maven project - the path of these resources is relative to the Maven projects base directory

  * KISS / Convention over Configuration - only a minimum set of options with reasonable defaults:
     - workflowDescriptor -> default "src/main/resources/generator/Workfloww.mwe2"
     - checkFileSets -> default "src/main/resources/*.btdesign"
     - jvmArguments
     - skip -> default "false"
     - force -> default "false"
     - verbose -> default "false"

  * Xtext logging is handled internally -> SLF4J / Logback are plugin dependencies and a reasonable Logback configuration shipped with the plugin (can be overriden via "jvmArgument" with "-Dlogback.configurationFile=<path to logback.xml>")


Running this plugin with the default Sculptor project layout needs the following configuration in the projects POM:

    <build>
        <plugins>
            <plugin>
                <groupId>org.fornax.toolsupport</groupId>
                <artifactId>sculptor-maven-plugin</artifactId>
                <version>1.0.0</version>
                <executions>
                    <execution>
                        <phase>generate-sources</phase>
                        <goals>
                            <goal>generate</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>   


A draft version of this plugin is already up and running :-)


What do you think?

/Torsten

[1] https://groups.google.com/d/msg/fornax-platform/Zzjlhb1b9_Q/B5APe7gAw5AJ

Patrik Nordwall

未读,
2012年1月11日 14:29:222012/1/11
收件人 fornax-...@googlegroups.com
That is great. Will make it default in archetypes if it works better than fornax-oaw-m2-plugin. The plugin dependencies is the way to go.

There is one System.property "fornax-oaw-m2-plugin.changedFiles" that the fornax-oaw-m2-plugin sets, which is used in Sculptor. It's not critical, but if this isn't used the partial generation feature will not be possible.

Note that src/main/resources/ from the project must be on the classpath, (e.g. sculptor-generator.properties)

Make sure it works for multi module projects and build started from paren, i.e. potential current directory issues.

/Patrik

Torsten Juergeleit

未读,
2012年1月12日 08:22:572012/1/12
收件人 fornax-...@googlegroups.com
> That is great. Will make it default in archetypes if it works better than fornax-oaw-m2-plugin. The plugin dependencies is the way to go.

I'm glad you like it.

> There is one System.property "fornax-oaw-m2-plugin.changedFiles" that the fornax-oaw-m2-plugin sets, which is used in Sculptor. It's not critical, but if this isn't used the partial generation feature will not be possible.

Ups, I forgot this. Thanx for pointing out.

> Note that src/main/resources/ from the project must be on the classpath, (e.g. sculptor-generator.properties)

Yes, the plugin creates a classpath consisting of "${basedir}/src/main/resources" and all the libraries needed for the Sculptor code generator.


> Make sure it works for multi module projects and build started from paren, i.e. potential current directory issues.

Yes, the commons-exec Executors working directory is set to the projects basedir.

/Torsten

Ron Smith

未读,
2012年1月12日 09:57:402012/1/12
收件人 Fornax-Platform
It'd be great to have this new plugin. The workaround I'm using
works, but it's far from ideal in that we have to have additional POM
files, and it seems to be preventing Eclipse from resolving artifacts
in the workspace when invoking Maven from Eclipse.

Is it in a state we can start trying it out?

--Ron


On Jan 11, 6:04 am, Torsten Juergeleit <torsten.juergel...@gmail.com>
wrote:

Torsten Juergeleit

未读,
2012年1月13日 07:23:452012/1/13
收件人 fornax-...@googlegroups.com
In changeset #7769[1] you can find version 1.0.0 of the new Sculptor maven plugin. The plugin has the following defaults:

  - version of Sculptor code generator (as plugin dependency) -> default "version 2.0.0"

  - workflowDescriptor -> default "src/main/resources/generator/Workfloww.mwe2"
  - checkFileSets -> default "src/main/resources/*.btdesign"
  - jvmArguments -> default "-client -Xms100m -Xmx500m"

  - skip -> default "false"
  - force -> default "false"
  - verbose -> default "false"


To run the plugin with version 2.1.0-SNAPSHOT of the Sculptor code generator and verbose logging add the following to the POM:


    <build>
      <plugins>
            :
        <plugin>
          <groupId>org.fornax.toolsupport</groupId>
          <artifactId>sculptor-maven-plugin</artifactId>
          <version>1.0.0</version>
          <executions>
            <execution>
              <id>code-generation</id>

              <goals>
                 <goal>generate</goal>
              </goals>
            </execution>
            <configuration>
              <verbose>true</verbose>
            </configuration>
            <dependencies>
              <dependency>
                <groupId>org.fornax.cartridges</groupId>
                <artifactId>fornax-cartridges-sculptor-generator</artifactId>
                <version>1.0.0-SNAPSHOT</version>
              </dependency>
            </dependencies>
          </executions>
        </plugin>
             :
      </plugins>
    </build> 


All project-specific dependencies which are needed by the code generator (mainly "model*.btdesign" embedded in jars created during multi-module builds) have to be added as plugin dependencies. The new plugin doesn't use any dependencies of the encolsing project!

/Torsten

[1] https://fisheye3.atlassian.com/changelog/fornax?cs=7769

Torsten Juergeleit

未读,
2012年1月13日 07:29:522012/1/13
收件人 fornax-...@googlegroups.com
Now I'm starting to update the Fornax M2E Extensions Eclipse plugin [1] to support the new Maven plugin.

/Torsten

[1] http://fornax.itemis.de/confluence/display/fornax/1.+Installation+Guide+%28CSC%29#1.InstallationGuide%28CSC%29-EclipseMavenIntegration%28m2e%29

Torsten Juergeleit

未读,
2012年1月13日 11:03:442012/1/13
收件人 fornax-...@googlegroups.com
The source code of the Fornax M2E Extensions Eclipse plugin/feature is updated in Fornax SVN.

@Patrik, please build [1] and deploy the new version of the Eclipse plugin/feature to the Fornax update site. Thanx.

/Torsten

[1] https://groups.google.com/d/msg/fornax-platform/hlWQmqYRXkI/_y4q-x23MfEJ

Patrik Nordwall

未读,
2012年1月13日 15:11:532012/1/13
收件人 fornax-...@googlegroups.com
Thanks for doing this. I will deploy the stuff on Sunday, including the maven plugin.

/Patrik

Patrik Nordwall

未读,
2012年1月15日 03:23:272012/1/15
收件人 Fornax-Platform
I have deployed 1.0.1 of Fornax M2E Extensions.
Install from http://fornax-platform.org/updatesite/site.xml

I have also deployed 1.0.0 of sculptor-maven-plugin

/Patrik

On Jan 13, 9:11 pm, Patrik Nordwall <patrik.nordw...@gmail.com> wrote:
> Thanks for doing this. I will deploy the stuff on Sunday, including the maven plugin.
>
> /Patrik
>
> On Jan 13, 2012, at 17:03, Torsten Juergeleit <torsten.juergel...@gmail.com> wrote:
>
>
>
>
>
>
>
> > The source code of the Fornax M2E Extensions Eclipse plugin/feature is updated in Fornax SVN.
>
> > @Patrik, please build [1] and deploy the new version of the Eclipse plugin/feature to the Fornax update site. Thanx.
>
> > /Torsten
>
> > [1]https://groups.google.com/d/msg/fornax-platform/hlWQmqYRXkI/_y4q-x23MfEJ
>
> > On Friday, 13 January 2012 13:29:52 UTC+1, Torsten Juergeleit wrote:
> > Now I'm starting to update the Fornax M2E Extensions Eclipse plugin [1] to support the new Maven plugin.
>
> > /Torsten
>
> > [1]http://fornax.itemis.de/confluence/display/fornax/1.+Installation+Gui...

Ron Smith

未读,
2012年1月21日 23:24:092012/1/21
收件人 Fornax-Platform
I've been using the new Maven plugin and the updated M2E extension for
a couple days, and it's been working great. I was able to bring back
Sculptor generation back into my main POMs without any issues.

The only thing I haven't been able to get working is Eclipse workspace
resolution when running the generate-sources Maven goal on my parent
POM within a multi-module project.
My project is fairly typical:
myproject-parent/pom.xml <- When built, builds all other modules
myproject/pom.xml <- service and repository classes, depends on
myproject-domain
myproject-domain/pom.xml <- this project contains Sculptor model files
all others use
myproject-web/pom.xml

If I build myproject-web or myproject within Eclipse individually,
Eclipse workspace resolution works, and the current model files from
myproject-domain are picked up.
If I build myproject-parent, workspace resolution isn't working, and
the classpath that each build uses includes the myproject-domain jar
in the maven repo instead of the myproject-domain project directories.
So I have to either run a full build (maven install) so the myproject-
domain jar gets built and installed, or I have to run Maven generate-
sources on each project individually.

I've turned on Maven resolution in each Eclipse project and all of the
Maven launchers.

Eclipse workspace resolution with a separate codegen pom wasn't
working at all for me before, so this is still a big improvement.

I wanted to see if this should be working for me and if this is
something specific to my set up.

Thanks
Ron


On Jan 15, 2:23 am, Patrik Nordwall <patrik.nordw...@gmail.com> wrote:
> I have deployed 1.0.1 of Fornax M2E Extensions.
> Install fromhttp://fornax-platform.org/updatesite/site.xml
回复全部
回复作者
转发
0 个新帖子