xml 将scala代码编译并打包到单个jar中。还包括可以省略的json4s的依赖项。

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml 将scala代码编译并打包到单个jar中。还包括可以省略的json4s的依赖项。相关的知识,希望对你有一定的参考价值。

<?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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.wm</groupId>
    <artifactId>wmLogger</artifactId>
    <version>1.0-SNAPSHOT</version>

    <name>${project.artifactId}-${project.version}</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <scala.version>2.10.3</scala.version>
        <!--<scala.version>2.11.0-RC3</scala.version>-->
    </properties>

    <dependencies>

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


        <dependency>
            <groupId>org.json4s</groupId>
            <!--<artifactId>json4s-native_${scala.version}</artifactId>-->
            <artifactId>json4s-native_2.10</artifactId>
            <version>3.2.7</version>
        </dependency>

        <dependency>
            <groupId>org.json4s</groupId>
            <!--<artifactId>json4s-jackson_${scala.version}</artifactId>-->
            <artifactId>json4s-jackson_2.10</artifactId>
            <version>3.2.7</version>
        </dependency>

    </dependencies>

    <build>
        <plugins>

            <plugin>
                <groupId>net.alchim31.maven</groupId>
                <artifactId>scala-maven-plugin</artifactId>
                <version>3.1.6</version>

                <executions>
                    <execution>
                        <id>scala-compile</id>
                        <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>

            <!--Packaging-->
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.wm.logger.WMLoggerTest</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>

        </plugins>
    </build>
</project>

以上是关于xml 将scala代码编译并打包到单个jar中。还包括可以省略的json4s的依赖项。的主要内容,如果未能解决你的问题,请参考以下文章

使用 SBT 将编译后的 Scala 文件打包到 jar 中

将scala代码打包到一个jar文件中,proguard不起作用

build.xml实例:清目录编译java编译scala打包

maven工程编译并生成可执行JAR包命令

mybatis学习------打包xml映射文件

如何反编译android应用并重新打包