zoukankan      html  css  js  c++  java
  • 在Maven中混用Java和Scala

    主要就是在pom.xml中添加scala的三个依赖包和maven-scala插件,配置如下:

    <?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">
        <parent>
            <artifactId>bdap</artifactId>
            <groupId>com.isoft</groupId>
            <version>1.0-SNAPSHOT</version>
        </parent>
        <modelVersion>4.0.0</modelVersion>
    
        <artifactId>bdap.analysis</artifactId>
    
        <properties>
            <scala.version>2.11.8</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>
            <dependency>
                <groupId>org.scala-lang</groupId>
                <artifactId>scala-reflect</artifactId>
                <version>${scala.version}</version>
            </dependency>
        </dependencies>
    
        <build>
            <plugins>
                <plugin>
                    <groupId>org.scala-tools</groupId>
                    <artifactId>maven-scala-plugin</artifactId>
                    <version>2.15.1</version>
                    <executions>
                        <execution>
                            <id>compile-scala</id>
                            <goals>
                                <goal>add-source</goal>
                                <goal>compile</goal>
                            </goals>
                        </execution>
                        <execution>
                            <id>test-compile-scala</id>
                            <goals>
                                <goal>add-source</goal>
                                <goal>testCompile</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    
    
    </project>

    然后运行mvn clean compile即可看到效果

  • 相关阅读:
    每日一剂 14-6-6
    每日一剂 14-6-5
    每日一剂 14-6-4
    每日一剂 14-5-30
    Maven清理 .lastUpdated文件
    Docker 将项目做成镜像部署在docker中
    Docker 镜像拷贝到 正式环境运行
    Docker 安装 Tomcat
    Docker 安装 ActiveMq
    Docker 安装 nginx
  • 原文地址:https://www.cnblogs.com/kevin19900306/p/5776490.html
Copyright © 2011-2022 走看看