playframework - 有没有什么好的方法可以让一个游戏变得更好!框架应用?

标签 playframework maven-3

我正在使用 play 作为 web 应用程序框架,我喜欢它,但我想知道是否有一种好方法可以为 play 声明 pom!应用程序 ?

由于源文件旨在位于 specials(不是 maven 标准)文件夹中,并且目标不是生成目标文件,而是允许在不同的 IDE(Eclipse、Netbeans、...)中管理项目

如果可以将 pom.xml 依赖项与 1.2.X conf/dependencies.yml 特定格式链接,那就太好了。

谢谢。

最佳答案

此问题的更新答案,因为 play install 不适用于 Play 2

我只需要 mavenify 一个 Play 2 应用程序。

为此,我使用了 play2-maven-pluginsbt-pom-reader .

我使用 sbt-pom-reader 来保留 play2-maven-plugin 尚不支持的热重载功能。

这是您需要配置 play2-maven 项目的方式:

<my-maven-project>/
  pom.xml                  <- Your maven build
  build.sbt                <- the sbt Play 2 configuration
  project/
     build.properties      <- the sbt version specification
     build.scala           <- the sbt build definition
     plugins.sbt           <- the sbt plugin configuration

  ..                       <- Whatever files are normally in your maven project.

每个文件应具有以下内容。

pom.xml:
<?xml version="1.0" encoding="UTF-8"?>
<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>org.foo</groupId>
    <artifactId>bar</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>play2</packaging>
    <name>My mavenified Play 2 application</name>
    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
        <play2.version>2.2.1</play2.version>
        <play2-scala.version>2.10</play2-scala.version>
        <play2.plugin.version>1.0.0-alpha5</play2.plugin.version>
        <scala.version>2.10.2</scala.version>
    </properties>
    <repositories>
        <repository>
            <id>typesafe</id>
            <name>Typesafe - releases</name>
            <url>http://repo.typesafe.com/typesafe/releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    <dependencies>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>${scala.version}</version>
        </dependency>
        <dependency>
            <groupId>com.typesafe.play</groupId>
            <artifactId>play_${play2-scala.version}</artifactId>
            <version>${play2.version}</version>
        </dependency>
        <!-- only if using Java -->
        <dependency>
            <groupId>com.typesafe.play</groupId>
            <artifactId>play-java_${play2-scala.version}</artifactId>
            <version>${play2.version}</version>
        </dependency>
    </dependencies>
    <build>
        <sourceDirectory>${basedir}/app</sourceDirectory>
        <resources>
            <resource>
                <directory>${basedir}/conf</directory>
            </resource>
            <resource>
                <directory>${basedir}</directory>
                <includes>
                    <include>public/**</include>
                </includes>
            </resource>
        </resources>
        <!--<outputDirectory>target/scala-${play2-scala.version}/classes</outputDirectory>-->
        <plugins>
            <plugin>
                <groupId>com.google.code.play2-maven-plugin</groupId>
                <artifactId>play2-maven-plugin</artifactId>
                <version>${play2.plugin.version}</version>
                <extensions>true</extensions>
                <dependencies>
                    <dependency>
                        <groupId>com.google.code.play2-maven-plugin</groupId>
                        <artifactId>play2-provider-play22</artifactId>
                        <version>${play2.plugin.version}</version>
                    </dependency>
                </dependencies>
                <!-- only if using Java -->
                <configuration>
                    <mainLang>java</mainLang>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

构建.sbt:
play.Project.playJavaSettings //or play.Project.playScalaSettings

项目/build.properties:
sbt.version=0.13.0

项目/build.scala:
object BuildFromMavenPomSettings extends com.typesafe.sbt.pom.PomBuild

项目/plugins.sbt:
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-pom-reader" % "1.0.1")

现在您可以使用 Maven 进行构建,使用 SBT 进行热重载开发。

关于playframework - 有没有什么好的方法可以让一个游戏变得更好!框架应用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7366904/

相关文章:

java - 找不到 MessageSource 的 ResourceBundle

java - 如何在Eclipse中查看maven项目的web内容

java - 在 IntelliJ IDEA 中导入 Maven 依赖项

java - 如何只返回 JSON 对象中的某些字段?

scala - 在 Play 中排队异步任务! - 正确的方式

java - 玩java mysql应用程序在长时间空闲时间后断开连接(可能是8小时后)

database - 如何在 Play 2.0 (Scala) 中使用 DATABSE_URL 进行本地连接到 mysql

java - play框架1.3.3和hibernate缓存

java - Eclipse Run As 中的 Maven 构建...选择到底是什么?

java - Maven 编译错误 : Fatal error compiling: invalid target release: 1. 8