2013-07-29 9 views
5

Qualcuno ha avuto successo nell'utilizzare Maven e Scalatra 2.2.1?Utilizzo di Scalatra 2.2.1 con Maven

Ho trovato questo vecchio archetipo https://github.com/Srirangan/scalatra-maven-prototype e ho provato ad aggiornare le versioni delle dipendenze, ma continuo a colpire i problemi di incompatibilità.

Mi piacerebbe usare:

  1. Scalatra 2.2.1
  2. Scala 2,10

penso che Jetty ha qualche problema per eseguire la guerra prodotta.

Apprezzerei molto il vostro aiuto su questo.

Ecco il progetto di esempio che sto usando: http://www.scalatra.org/2.2/getting-started/first-project.html

E la mia attuale pom.xml:

<?xml version='1.0' encoding='UTF-8'?> 
<project 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" 
    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 

    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.example</groupId> 
    <artifactId>my-scalatra-web-app</artifactId> 
    <packaging>war</packaging> 
    <version>1.0-SNAPSHOT</version> 

    <properties> 
     <scalatra.version>2.2.1</scalatra.version> 
    </properties> 

    <build> 
     <finalName>scalatra-maven-prototype</finalName> 
     <sourceDirectory>src/main/scala</sourceDirectory> 
     <testSourceDirectory>src/test/scala</testSourceDirectory> 
     <plugins> 
      <plugin> 
       <groupId>org.scala-tools</groupId> 
       <artifactId>maven-scala-plugin</artifactId> 
       <version>2.15.0</version> 
       <executions> 
        <execution> 
         <goals> 
          <goal>compile</goal> 
          <goal>testCompile</goal> 
         </goals> 
         <configuration> 
          <args> 
           <arg>-make:transitive</arg> 
           <arg>-dependencyfile</arg> 
           <arg>${project.build.directory}/.scala_dependencies</arg> 
          </args> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-plugin</artifactId> 
       <version>2.6</version> 
       <configuration> 
        <useFile>false</useFile> 
        <disableXmlReport>true</disableXmlReport> 
        <includes> 
         <include>**/*Test.*</include> 
         <include>**/*Suite.*</include> 
        </includes> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.mortbay.jetty</groupId> 
       <artifactId>maven-jetty-plugin</artifactId> 
       <version>6.1.17</version> 
      </plugin> 
     </plugins> 
    </build> 

    <dependencies> 
     <dependency> 
      <groupId>org.scalatra</groupId> 
      <artifactId>scalatra_2.10</artifactId> 
      <version>${scalatra.version}</version> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.scalatra</groupId> 
      <artifactId>scalatra-scalate_2.10</artifactId> 
      <version>${scalatra.version}</version> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.scalatra</groupId> 
      <artifactId>scalatra-specs2_2.10</artifactId> 
      <version>${scalatra.version}</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.mortbay.jetty</groupId> 
      <artifactId>servlet-api</artifactId> 
      <version>3.0.20100224</version> 
      <scope>provided</scope> 
     </dependency> 
     <dependency> 
      <groupId>ch.qos.logback</groupId> 
      <artifactId>logback-classic</artifactId> 
      <version>1.0.6</version> 
      <scope>runtime</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.scala-lang</groupId> 
      <artifactId>scala-library</artifactId> 
      <version>2.10.2</version> 
      <scope>compile</scope> 
     </dependency> 
    </dependencies> 

    <repositories> 
     <repository> 
      <id>SonatypeNexusSnapshots</id> 
      <name>Sonatype Nexus Snapshots</name> 
      <url>https://oss.sonatype.org/content/repositories/snapshots/</url> 
     </repository> 
     <repository> 
      <id>FuseSourceSnapshotRepository</id> 
      <name>FuseSource Snapshot Repository</name> 
      <url>http://repo.fusesource.com/nexus/content/repositories/snapshots/</url> 
     </repository> 
     <repository> 
      <id>ScalaToolsMaven2Repository</id> 
      <name>Scala-Tools Maven2 Repository</name> 
      <url>http://scala-tools.org/repo-releases/</url> 
     </repository> 
     <repository> 
      <id>scala-tools.org</id> 
      <name>Scala-Tools Maven2 Repository</name> 
      <url>http://scala-tools.org/repo-releases</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> 
    </pluginRepositories> 

</project> 

risposta

11

Ok dopo un sacco di piangere, ho trovato le versioni corrette da utilizzare, e la corretti artefatti. Spero che sia utile per qualcuno:

<?xml version='1.0' encoding='UTF-8'?> 
<project 
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" 
    xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 

    <modelVersion>4.0.0</modelVersion> 
    <groupId>com.example</groupId> 
    <artifactId>my-scalatra-web-app</artifactId> 
    <packaging>war</packaging> 
    <version>1.0-SNAPSHOT</version> 

    <properties> 
     <scalatra.version>2.2.1</scalatra.version> 
    </properties> 

    <build> 
     <finalName>scalatra-maven-prototype</finalName> 
     <sourceDirectory>src/main/scala</sourceDirectory> 
     <testSourceDirectory>src/test/scala</testSourceDirectory> 
     <plugins> 
      <plugin> 
       <groupId>org.scala-tools</groupId> 
       <artifactId>maven-scala-plugin</artifactId> 
       <version>2.15.0</version> 
       <executions> 
        <execution> 
         <goals> 
          <goal>compile</goal> 
          <goal>testCompile</goal> 
         </goals> 
         <configuration> 
          <args> 
           <arg>-make:transitive</arg> 
           <arg>-dependencyfile</arg> 
           <arg>${project.build.directory}/.scala_dependencies</arg> 
          </args> 
         </configuration> 
        </execution> 
       </executions> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-surefire-plugin</artifactId> 
       <version>2.6</version> 
       <configuration> 
        <useFile>false</useFile> 
        <disableXmlReport>true</disableXmlReport> 
        <includes> 
         <include>**/*Test.*</include> 
         <include>**/*Suite.*</include> 
        </includes> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.eclipse.jetty</groupId> 
       <artifactId>jetty-maven-plugin</artifactId> 
       <version>9.0.4.v20130625</version> 
      </plugin> 
     </plugins> 
    </build> 

    <dependencies> 
     <dependency> 
      <groupId>org.scalatra</groupId> 
      <artifactId>scalatra_2.10</artifactId> 
      <version>${scalatra.version}</version> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.scalatra</groupId> 
      <artifactId>scalatra-scalate_2.10</artifactId> 
      <version>${scalatra.version}</version> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.scalatra</groupId> 
      <artifactId>scalatra-specs2_2.10</artifactId> 
      <version>${scalatra.version}</version> 
      <scope>test</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.eclipse.jetty.orbit</groupId> 
      <artifactId>javax.servlet</artifactId> 
      <version>3.0.0.v201112011016</version> 
     </dependency> 
     <dependency> 
      <groupId>org.eclipse.jetty</groupId> 
      <artifactId>jetty-webapp</artifactId> 
      <version>9.0.4.v20130625</version> 
      <scope>compile</scope> 
     </dependency> 
     <dependency> 
      <groupId>ch.qos.logback</groupId> 
      <artifactId>logback-classic</artifactId> 
      <version>1.0.13</version> 
      <scope>runtime</scope> 
     </dependency> 
     <dependency> 
      <groupId>org.scala-lang</groupId> 
      <artifactId>scala-library</artifactId> 
      <version>2.10.2</version> 
      <scope>compile</scope> 
     </dependency> 
    </dependencies> 

    <repositories> 
     <repository> 
      <id>SonatypeNexusSnapshots</id> 
      <name>Sonatype Nexus Snapshots</name> 
      <url>https://oss.sonatype.org/content/repositories/snapshots/</url> 
     </repository> 
     <repository> 
      <id>FuseSourceSnapshotRepository</id> 
      <name>FuseSource Snapshot Repository</name> 
      <url>http://repo.fusesource.com/nexus/content/repositories/snapshots/</url> 
     </repository> 
     <repository> 
      <id>ScalaToolsMaven2Repository</id> 
      <name>Scala-Tools Maven2 Repository</name> 
      <url>http://scala-tools.org/repo-releases/</url> 
     </repository> 
     <repository> 
      <id>scala-tools.org</id> 
      <name>Scala-Tools Maven2 Repository</name> 
      <url>http://scala-tools.org/repo-releases</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> 
    </pluginRepositories> 

</project> 
+0

Qual è il comando di compilazione/esecuzione? –

+1

Quello sarebbe lo standard 'mvn compile' e 'mvn jetty: run'. – merejy

+0

Ti dispiacerebbe aggiornare la tua risposta con le ultime versioni delle varie dipendenze e con le versioni successive di scalatra stesso? Ti ho dato un upvote per suscitare un po 'di "buona volontà" a questo proposito;) – javadba