gpt4 book ai didi

maven - 在 Maven 中使用 Scalatra 2.2.1

转载 作者:行者123 更新时间:2023-12-04 13:40:25 25 4
gpt4 key购买 nike

有没有人成功使用过 Maven 和 Scalatra 2.2.1?

我找到了这个旧原型(prototype) https://github.com/Srirangan/scalatra-maven-prototype并尝试更新依赖版本,但我一直遇到不兼容问题。

我想使用:

  • 斯卡拉特拉 2.2.1
  • 斯卡拉 2.10

  • 我认为 Jetty 有一些问题来运行生产的 war 。

    我非常感谢您对此提供的帮助。

    这是我正在使用的示例项目:
    http://www.scalatra.org/2.2/getting-started/first-project.html

    还有我当前的 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>

    最佳答案

    好吧,在哭了很久之后,我找到了正确的版本和正确的 Artifact 。
    希望它对某人有帮助:

    <?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>

    关于maven - 在 Maven 中使用 Scalatra 2.2.1,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17928073/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com