有没有一个很好的方法来戏剧化!框架申请?

iXô*_*iXô 12 maven-3 playframework

我正在使用Play作为Web应用程序框架,我很喜欢它,但我想知道是否有一种很好的方式来宣传游戏的pom!应用?

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

如果能够将pom.xml依赖项与1.2.X conf/dependencies.yml特定格式链接起来会很棒.

谢谢.

Pie*_*age 8

作为播放安装的此问题的更新答案不适用于Play 2

我只需要对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.
Run Code Online (Sandbox Code Playgroud)

每个文件都应包含以下内容.

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>
Run Code Online (Sandbox Code Playgroud)

build.sbt:

play.Project.playJavaSettings //or play.Project.playScalaSettings
Run Code Online (Sandbox Code Playgroud)

项目/ build.properties:

sbt.version=0.13.0
Run Code Online (Sandbox Code Playgroud)

项目/ build.scala:

object BuildFromMavenPomSettings extends com.typesafe.sbt.pom.PomBuild
Run Code Online (Sandbox Code Playgroud)

项目/ plugins.sbt:

addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.2.1")

addSbtPlugin("com.typesafe.sbt" % "sbt-pom-reader" % "1.0.1")
Run Code Online (Sandbox Code Playgroud)

现在,您可以使用Maven进行构建,使用SBT进行热重新加载.


Mar*_*ler 6

有一些不同的插件支持这个:

  1. AbsurdHero的Play Pure Maven插件.这支持将scala.html文件转换为scala,将静态资源链接到目标目录,以及监视源文件并自动重新加载到测试服务器.它没有任何支持来创建可以部署的jar/war/zip.它不需要在机器上安装Play,因此它可以与CI服务器一起使用,尽管您需要将插件jar放到CI机器上,例如使用像Nexus这样的本地Maven存储库.
  2. Nanoko玩-2 Maven插件.我还没有使用过这个 - 它说它是游戏框架的包装器所以它需要在构建机器上安装Play.它确实支持构建war并调试或运行应用程序.

还有其他人?我有兴趣听听其他选择吗?


yur*_*ura 4

是的,有play maven模块。所以你需要安装它“play install maven”然后调用“play mvn:init”。然后每次更新时调用“play mvn:up”。集成不是很好,意味着maven以一种方式发挥依赖。并且并非所有 Maven 命令都受支持。但 playfremwork2 将完全基于 SBT(又名 Scala 上的 Maven)

  • 我不知道这在编写时是否有效,但今天在 Play 2.0 中不起作用 - 我希望我找到了解决方案! (4认同)