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即可看到效果

  • 相关阅读:
    [rabbitmq] python版本(二) 工作队列
    [rabbitmq] python版本(一)HelloWorld
    rabbitmq安装上手
    leetcode1 两数之和
    mybatis学习笔记(一)入门上手
    神经网络简介
    hexo+github pages搭建个人博客
    简单RTSCamera实现
    数据结构复习:树
    LINQ
  • 原文地址:https://www.cnblogs.com/kevin19900306/p/5776490.html
Copyright © 2011-2022 走看看