美文网首页
idea 下通过maven 打包scala项目运行:

idea 下通过maven 打包scala项目运行:

作者: 夜空最亮的9星 | 来源:发表于2019-09-29 18:37 被阅读0次

idea 通过maven 打包scala项目运行:


    <properties>
        <scala-maven-plugin.version>3.1.3</scala-maven-plugin.version>
        <scala.version>2.10.7</scala.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>${scala.version}</version>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-compiler</artifactId>
            <version>${scala.version}</version>
        </dependency>
    </dependencies>




    <build>
        <plugins>

            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.5.5</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.demo.Hello</mainClass>
                        </manifest>
                    </archive>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

            <plugin>
                <groupId>org.scala-tools</groupId>
                <artifactId>maven-scala-plugin</artifactId>
                <version>2.15.2</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>testCompile</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>


package com.demo

object Hello {

  def main(args: Array[String]): Unit = {

    println("=========================")
    println("=========================")
    println("Hello World and scala")
    println("=========================")
    println("=========================")
  }
}

打包运行:java -jar Demo.jar


image

相关文章

网友评论

      本文标题:idea 下通过maven 打包scala项目运行:

      本文链接:https://www.haomeiwen.com/subject/vrovyctx.html