Josh, Jean-Luc,

i resolved my problem with a workaround. See the pom file below. There are
still some desiderata.

   - As written this generates the reversed-engineered JPA classes in place
   - It also generates the resource classes (from the JPA classes) in place
   - it requires two consequtive calls to 'mvn compile' to have a complete
   build

What i would like to happen is

   - a phase generates the JPA classes to a subdir of build dir, call it
   reverse.jpa
   - after validation, another phase-goal generates the resource classes to
   a subdir of reverse.jpa
   - finally there is a follow up compilation that includes the generated
   classes

i tried several different ways to get this to work, but my mvn-fu is still
too unsophisticated for a job like that.


Best wishes,

--greg


<project xmlns="http://maven.apache.org/POM/4.0.0"; xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance"; xsi:schemaLocation="
http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd";>
  <modelVersion>4.0.0</modelVersion>
  <groupId>com.sap.dspace</groupId>
  <artifactId>dspace</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>war</packaging>
  <name>dspace</name>
  <inceptionYear>2007</inceptionYear>
  <properties>
    <scala.version>2.7.3</scala.version>
  </properties>

  <repositories>
    <repository>
      <id>scala-tools.org</id>
      <name>Scala-Tools Maven2 Repository</name>
      <url>http://scala-tools.org/repo-releases</url>
    </repository>
    <repository>
      <id>maven2-repository.dev.java.net</id>
      <name>Java.net Repository for Maven</name>
      <url>http://download.java.net/maven/2</url>
      <layout>default</layout>
    </repository>
    <repository>
      <id>dspace-local-repo</id>
      <url>file://${basedir}/vendor/lib</url>
    </repository>
  </repositories>

  <pluginRepositories>
    <pluginRepository>
      <id>scala-tools.org</id>
      <name>Scala-Tools Maven2 Repository</name>
      <url>http://scala-tools.org/repo-releases</url>
    </pluginRepository>
    <pluginRepository>
      <id>maven2-repository.dev.java.net</id>
      <name>Java.net Repository for Maven</name>
      <url>http://download.java.net/maven/2</url>
    </pluginRepository>
  </pluginRepositories>

  <dependencies>
    <dependency>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala-library</artifactId>
      <version>${scala.version}</version>
    </dependency>
    <dependency>
      <groupId>net.liftweb</groupId>
      <artifactId>lift-core</artifactId>
      <version>1.0</version>
    </dependency>
    <dependency>
      <groupId>org.apache.derby</groupId>
      <artifactId>derby</artifactId>
      <version>10.2.2.0</version>
    </dependency>
    <dependency>
      <groupId>javax.servlet</groupId>
      <artifactId>servlet-api</artifactId>
      <version>2.5</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>junit</groupId>
      <artifactId>junit</artifactId>
      <version>3.8.1</version>
      <scope>test</scope>
    </dependency>
    <dependency>
      <groupId>org.mortbay.jetty</groupId>
      <artifactId>jetty</artifactId>
      <version>[6.1.6,)</version>
      <scope>test</scope>
    </dependency>
    <!-- for LiftConsole -->
    <dependency>
      <groupId>org.scala-lang</groupId>
      <artifactId>scala-compiler</artifactId>
      <version>${scala.version}</version>
      <scope>test</scope>
    </dependency>

    <dependency>
      <groupId>geronimo-spec</groupId>
      <artifactId>geronimo-spec-ejb</artifactId>
      <version>2.1-rc4</version>
    </dependency>
    <dependency>
      <groupId>org.hibernate</groupId>
      <artifactId>hibernate-entitymanager</artifactId>
      <version>3.3.2.GA</version>
      <exclusions>
    <exclusion>
      <groupId>javax.transaction</groupId>
      <artifactId>jta</artifactId>
    </exclusion>
      </exclusions>
    </dependency>
    <dependency>
      <groupId>geronimo-spec</groupId>
      <artifactId>geronimo-spec-jta</artifactId>
      <version>1.0.1B-rc4</version>
      <scope>provided</scope>
    </dependency>
    <!-- local hibernate stuff -->
    <dependency>
      <groupId>hibernate</groupId>
      <artifactId>hibernate3</artifactId>
      <version>local</version>
    </dependency>
    <dependency>
      <groupId>hibernate</groupId>
      <artifactId>hibernate-tools</artifactId>
      <version>local</version>
    </dependency>
    <dependency>
      <groupId>mysql</groupId>
      <artifactId>mysql-connector-java</artifactId>
      <version>local</version>
    </dependency>
    <!-- Needed for schemagen -->
    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-xjc</artifactId>
      <version>2.0.2</version>
    </dependency>
    <!-- Needed for schemagen -->
    <dependency>
      <groupId>javax.activation</groupId>
      <artifactId>activation</artifactId>
      <version>1.1</version>
    </dependency>
    <!-- Needed for schemagen -->
    <dependency>
      <groupId>javax.xml.bind</groupId>
      <artifactId>jsr173_api</artifactId>
      <version>1.0</version>
    </dependency>
    <dependency>
      <groupId>com.sun.jersey</groupId>
      <artifactId>jersey-server</artifactId>
      <version>1.0.2</version>
    </dependency>
    <dependency>
      <groupId>com.sun.jersey</groupId>
      <artifactId>jersey-client</artifactId>
      <version>1.0.2</version>
      <scope>test</scope>
    </dependency>
    <!-- <dependency> -->
<!--       <groupId>com.sun.grizzly</groupId> -->
<!--       <artifactId>grizzly-servlet-webserver</artifactId> -->
<!--       <version>1.8.6</version> -->
<!--     </dependency> -->
  </dependencies>

  <build>
    <sourceDirectory>src/main/scala</sourceDirectory>
    <testSourceDirectory>src/test/scala</testSourceDirectory>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <configuration>
          <source>1.5</source>
          <target>1.5</target>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.scala-tools</groupId>
        <artifactId>maven-scala-plugin</artifactId>
    <executions>
      <execution>
        <id>scala-compile-first</id>
        <phase>generate-resources</phase>
        <goals>
          <goal>add-source</goal>
          <goal>compile</goal>
        </goals>
      </execution>
      <execution>
        <id>scala-compile-second</id>
        <phase>process-classes</phase>
        <goals>
          <goal>compile</goal>
        </goals>
      </execution>
      <execution>
        <id>scala-test-compile</id>
        <phase>process-test-resources</phase>
        <goals>
          <goal>testCompile</goal>
        </goals>
      </execution>
      <execution>
            <goals>
              <goal>compile</goal>
              <goal>testCompile</goal>
            </goals>
          </execution>
    </executions>
        <configuration>
          <scalaVersion>${scala.version}</scalaVersion>
      <displayCmd>true</displayCmd>
      <jvmArgs>
         <jvmArg>-Xdebug</jvmArg>
         <jvmArg>-Xnoagent</jvmArg>
         <jvmArg>-Djava.compiler=NONE</jvmArg>

<jvmArg>-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005</jvmArg>
      </jvmArgs>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.mortbay.jetty</groupId>
        <artifactId>maven-jetty-plugin</artifactId>
        <configuration>
          <contextPath>/</contextPath>
          <scanIntervalSeconds>5</scanIntervalSeconds>
        </configuration>
      </plugin>
      <plugin>
        <groupId>net.sf.alchim</groupId>
        <artifactId>yuicompressor-maven-plugin</artifactId>
        <executions>
          <execution>
            <goals>
              <goal>compress</goal>
            </goals>
          </execution>
        </executions>
        <configuration>
          <nosuffix>true</nosuffix>
        </configuration>
      </plugin>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-eclipse-plugin</artifactId>
        <configuration>
          <downloadSources>true</downloadSources>
          <excludes>
            <exclude>org.scala-lang:scala-library</exclude>
          </excludes>
          <classpathContainers>

<classpathContainer>ch.epfl.lamp.sdt.launching.SCALA_CONTAINER</classpathContainer>
          </classpathContainers>
          <projectnatures>

<java.lang.String>ch.epfl.lamp.sdt.core.scalanature</java.lang.String>

<java.lang.String>org.eclipse.jdt.core.javanature</java.lang.String>
          </projectnatures>
          <buildcommands>

<java.lang.String>ch.epfl.lamp.sdt.core.scalabuilder</java.lang.String>
          </buildcommands>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.sun.tools.jxc.maven2</groupId>
        <artifactId>maven-jaxb-schemagen-plugin</artifactId>
    <version>1.2</version>
    <configuration>
      <destdir>${project.build.directory}/generated-schema</destdir>
      <schemas>
        <schema>
          <namespace>http://dspace.sap.com/</namespace>
          <file>constellation.xsd</file>
        </schema>
      </schemas>
      <srcdir>${basedir}/src/main/java/constellation.pojos</srcdir>
      <verbose>true</verbose>
    </configuration>
    <!-- <executions> -->
<!--       <execution> -->
<!--         <phase>process-sources</phase> -->
<!--         <configuration> -->
<!--
<destdir>${project.build.directory}/generated-schema</destdir> -->
<!--           <schemas> -->
<!--         <schema> -->
<!--           <namespace>http://dspace.sap.com/</namespace> -->
<!--           <file>constellation.xsd</file> -->
<!--         </schema> -->
<!--           </schemas> -->
<!--
<srcdir>${project.build.directory}/../src/main/java/com/sap/dspace/model/constellation</srcdir>
-->
<!--           <verbose>true</verbose> -->
<!--         </configuration> -->
<!--         <goals> -->
<!--           <goal>generate</goal> -->
<!--         </goals> -->
<!--       </execution> -->
<!--     </executions> -->
      </plugin>
      <!--  Maven Exec Plug-In: http://mojo.codehaus.org/exec-maven-plugin/
-->
      <!-- <plugin> -->
<!--     <groupId>org.codehaus.mojo</groupId> -->
<!--     <artifactId>exec-maven-plugin</artifactId> -->
<!--     <version>1.1</version> -->
<!--     <executions> -->
<!--       <execution> -->
<!--         <goals> -->
<!--           <goal>java</goal> -->
<!--         </goals> -->
<!--       </execution> -->
<!--     </executions> -->
<!--     <configuration> -->
<!--       <mainClass>com.sap.dspace.lib.Main</mainClass> -->
<!--     </configuration> -->
<!--       </plugin> -->

      <!--  Maven Exec Plug-In: http://mojo.codehaus.org/exec-maven-plugin/
-->
      <plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>exec-maven-plugin</artifactId>
    <version>1.1</version>
    <executions>
      <execution>
        <id>generate</id>
        <phase>compile</phase>
        <goals>
          <goal>exec</goal>
        </goals>
        <configuration>
          <executable>scala</executable>
          <arguments>
        <argument>-classpath</argument>
        <classpath refid="compile.classpath"/>
        <argument>scripts/GenerateFiles.scala</argument>

<argument>${basedir}/src/main/scala/com/sap/dspace/model/constellation/</argument>
          </arguments>
        </configuration>
      </execution>
<!--       <execution> -->
<!--         <id>publish</id> -->
<!--         <phase>process-classes</phase> -->
<!--         <goals> -->
<!--           <goal>exec</goal> -->
<!--         </goals> -->
<!--         <configuration> -->
<!--           <executable>cp</executable> -->
<!--           <arguments> -->
<!--         <argument>-r</argument> -->
<!--
<argument>${project.build.directory}/generated-java/reverse/com/sap/dspace/model/constellation/resources</argument>
-->
<!--
<argument>${basedir}/src/main/scala/com/sap/dspace/model/constellation</argument>
-->
<!--           </arguments> -->
<!--         </configuration> -->
<!--       </execution> -->
    </executions>
      </plugin>

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-antrun-plugin</artifactId>
        <executions>
          <execution>
            <id>reverse</id>
            <phase>generate-sources</phase>
            <configuration>
              <tasks>
                <property name="reverse.root"
value="${basedir}/src/main/java/reverse"/>
        <!-- property name="reverse.dest"
value="${project.build.directory}/generated-java"/-->
        <property name="reverse.dest" value="${basedir}/src/main/scala"/>
                <ant antfile="${basedir}/src/main/java/reverse/build.xml">
                  <target name="reveng.entities"/>
                </ant>
              </tasks>
            </configuration>
            <goals>
              <goal>run</goal>
            </goals>
          </execution>
        </executions>
      </plugin>

    </plugins>
  </build>
  <reporting>
    <plugins>
      <plugin>
        <groupId>org.scala-tools</groupId>
        <artifactId>maven-scala-plugin</artifactId>
        <configuration>
          <scalaVersion>${scala.version}</scalaVersion>
        </configuration>
      </plugin>
    </plugins>
  </reporting>
</project>


On Tue, Mar 3, 2009 at 11:50 AM, Josh Suereth <[email protected]>wrote:

> The "args" parameter as defined in:
> http://scala-tools.org/mvnsites/maven-scala-plugin/script-mojo.html  is
> meant to be used in the <configuration> section of your maven-scala-plugin
> defintion section in your pom.   Maven has some sugar to allow environment
> variables to replace these configuraiton variables, using something like
> -Dmaven.scala-plugin.args=...   I'll have to look this up, but for now
> please use the pom file or Jean-Luc's suggestion.
>
> -Josh
>
>
> On Tue, Mar 3, 2009 at 1:24 PM, Jean-Luc <[email protected]> wrote:
>
>> the -Dargs parameter is labelled as "compiler additionnals arguments" in
>> http://scala-tools.org/mvnsites/maven-scala-plugin/script-mojo.html
>>
>> Moreover, from the source code :
>> step 1 : a scala class is generated in ./target/.scalaScriptGen ; it looks
>> like this :
>> class embeddedScript_1  {
>>     // your script content here
>>    Thread.sleep(10000)
>> }
>>
>> step 2 : it is executed here :
>> http://scala-tools.org/mvnsites/maven-scala-plugin/xref/org/scala_tools/maven/ScalaScriptMojo.html#172
>> step 3 : the temp files are removed
>>
>> The only way I see to get some external parameter is using something like
>> System.getProperty("args") in "yourscript.scala" with a
>> -DscriptFile="yourscript.scala"
>>
>>
>> Jean-Luc
>>
>>
>> 2009/3/3 Meredith Gregory <[email protected]>
>>
>>>  Scalads, lasses and Lifted,
>>>
>>> i clearly don't understand the mvn scala:script widget. This just works
>>>
>>> > scala -classpath $MYSCRIPTCLASSPATH scripts/GenerateFiles.scala
>>> "/Users/lgm/work/src/projex/bobj/dspace/src/main/java/com/sap/dspace/model/constellation/"
>>>
>>> (where MYSCRIPTCLASSPATH was set with and export to the value generated
>>> by a mvn compile with appropriate verbosity on). But this doesn't
>>>
>>> > mvn scala:script -DscriptFile=scripts/GenerateFiles.scala
>>> -Dargs="src/main/java/com/sap/dspace/model/constellation/"
>>>
>>> The latter complains -- as in the message below -- that 'args' is not
>>> defined.
>>>
>>> Best wishes,
>>>
>>> --greg
>>> - Mostrar texto citado -
>>>
>>>
>> --
>> Jean-Luc Canela
>> [email protected]
>>
>>
>>
>>
>
> >
>


-- 
L.G. Meredith
Managing Partner
Biosimilarity LLC
806 55th St NE
Seattle, WA 98105

+1 206.650.3740

http://biosimilarity.blogspot.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to