Greg,

I'm guessing that you're generated java classes with that commented out
section?  You have to ensure that the maven-scala-plugin is run *before* the
java compiler when using mixed-java/scala projects.

Here's the mvn-fu (also shown
here<http://scala-tools.org/mvnsites/maven-scala-plugin/usage_java.html>
):

<plugin>
                                <groupId>org.scala-tools</groupId>
                                <artifactId>maven-scala-plugin</artifactId>
                                <executions>
                                        <execution>
                                                <id>scala-compile-first</id>
                                                <phase>process-resources</phase>
                                                <goals>
                                                    <goal>add-source</goal>
                                                        <goal>compile</goal>
                                                </goals>
                                        </execution>                            
                                        
                                        <execution>
                                                <id>scala-test-compile</id>
                                                
<phase>process-test-resources</phase>
                                                <goals>
                                                        <goal>testCompile</goal>
                                                </goals>
                                        </execution>
                                </executions>
                        </plugin>



What we're doing is "faking" the order of execution (as there's a "design
flaw" in maven 2.0.x that is being fixed in 3.0).  See
here<http://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html>for
the full maven lifecycle.  I'm going to list out the goals I see bound
to phases in your build (if you use the above configuration):

process-sources <- maven-jaxb-schemagen-plugin : generate   (generates your
.java files)
process-resources <- {
    maven-resources-plugin : copy-resources  (moves resources to "target"
directory)
    maven-scala-plugin : compile  (Compiles .scala code, passing .java files
to scalac)
}
compile <- maven-compiler-plugin : compile (Compiles Java code, including
generated code)
process-test-resources <- maven-scala-plugin : testCompile (compiles .scala
code, passing .java files to scalac)
test-compile <- maven-compiler-plugin : testCompile (Compiles java testing
code)
test <- maven-surefire-plugin : test (Runs junit/other tests)
package <- maven-war-plugin : war  (Creates your war file)
...


As you can see, this method (although slightly a hack) ensures the proper
ordering of plugins so your build should complete successfully!

-Josh

On Mon, Mar 2, 2009 at 7:29 PM, Meredith Gregory
<[email protected]>wrote:

> Josh,
>
> Thanks for the response. Sadly, my mvn-fu is novitiate level; so, the pom
> is little more than the vanilla pom that comes with a lift archetype. See
> below.
>
> 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</version>
>     </dependency>
>     <dependency>
>       <groupId>com.sun.jersey</groupId>
>       <artifactId>jersey-client</artifactId>
>       <version>1.0</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>
>             <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>
>     </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 Mon, Mar 2, 2009 at 3:50 PM, Josh Suereth <[email protected]>wrote:
>
>> Mind sending me a pom and general layout of your project structure?
>>
>> There could be two solutions:  1- Move things into a multi-module project
>> where your model.scala exists in one module and the other code in another
>> module or 2 - We make sure the goal->phase bindings are appropriate for what
>> you want to do.
>>
>>
>> -Josh
>>
>>
>> On Mon, Mar 2, 2009 at 6:42 PM, Meredith Gregory <
>> [email protected]> wrote:
>>
>>> Lifted,
>>>
>>> i've got all the classes i generate making a class to a Model object
>>> derived from the nice work that Derek did on the JPA demo. Now, here's the
>>> rub. For some reason it's compiling the generated classes before tackling
>>> the compilation of the model object. So... the compilation craps out. i've
>>> been working around this by generating the classes, compiling the project
>>> (without the classes) then moving them into place in the model directory and
>>> compiling the project again. What's the pretty way to enforce this
>>> sequentialization in maven. i really want these classes compiled *after*the 
>>> Model.scala file is compiled. i'd like not to say much more than this
>>> ordering constraint to maven -- if at all possible.
>>>
>>> Best wishes,
>>>
>>> --greg
>>>
>>> --
>>> L.G. Meredith
>>> Managing Partner
>>> Biosimilarity LLC
>>> 806 55th St NE
>>> Seattle, WA 98105
>>>
>>> +1 206.650.3740
>>>
>>> http://biosimilarity.blogspot.com
>>>
>>>
>>>
>>
>>
>>
>
>
> --
> 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