Scala和Java混合项目搭建:(Eclipse)
Scala和Java混合项目搭建:(Eclipse)
项目结构:
pom.xml:
<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>com.citi.sky</groupId>
<artifactId>AkkaPJ</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging> <name>AkkaPJ</name>
<url>http://maven.apache.org</url> <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<jdk.version>1.8</jdk.version>
<scala.version>2.11.8</scala.version>
<akka.version>2.5.9</akka.version>
<scalatest.version>3.0.4</scalatest.version>
</properties> <dependencies> <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency> <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> <dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-actor_2.11</artifactId>
<version>${akka.version}</version> </dependency> <dependency>
<groupId>com.typesafe.akka</groupId>
<artifactId>akka-testkit_2.11</artifactId>
<version>${akka.version}</version>
<scope>test</scope>
</dependency> <dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.11</artifactId>
<version>${scalatest.version}</version>
<scope>test</scope>
</dependency> </dependencies> <build>
<plugins> <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>3.0.0</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/src/main/java</source>
<source>${basedir}/src/main/scala</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-test-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-test-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/src/test/java</source>
<source>${basedir}/src/test/scala</source>
</sources>
</configuration>
</execution>
<execution>
<id>add-resource</id>
<phase>generate-sources</phase>
<goals>
<goal>add-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
<execution>
<id>add-test-resource</id>
<phase>generate-sources</phase>
<goals>
<goal>add-test-resource</goal>
</goals>
<configuration>
<resources>
<resource>
<directory>${basedir}/src/test/resources</directory>
<filtering>true</filtering>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin> <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<createDependencyReducedPom>false</createDependencyReducedPom>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>allInOne</shadedClassifierName>
<artifactSet>
<includes>
<include>*:*</include>
</includes>
</artifactSet> <filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
<transformers>
<transformer
implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.citi.dw.client.ClientTest</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin> <!--< build circular dependencies between Java and Scala> -->
<plugin>
<groupId>net.alchim31.maven</groupId>
<artifactId>scala-maven-plugin</artifactId>
<version>3.3.1</version>
<executions>
<execution>
<id>compile-scala</id>
<phase>compile</phase>
<goals>
<goal>add-source</goal>
<goal>compile</goal>
</goals>
</execution>
<execution>
<id>test-compile-scala</id>
<phase>test-compile</phase>
<goals>
<goal>add-source</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
<configuration>
<scalaVersion>${scala.version}</scalaVersion>
</configuration>
</plugin> </plugins>
</build> </project>
.classpath:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" output="target/classes" path="src/main/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src/main/scala"/>
<classpathentry kind="src" path="src/main/resources"/>
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
<attributes>
<attribute name="optional" value="true"/>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="src" path="src/test/scala"/>
<classpathentry kind="src" path="src/test/resources"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jdk1.8.0_121">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
<attributes>
<attribute name="maven.pomderived" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.scala-ide.sdt.launching.SCALA_CONTAINER"/>
<classpathentry kind="output" path="target/classes"/>
</classpath>
Log:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building AkkaPJ 0.0.1-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ AkkaPJ ---
[INFO] Deleting E:\git\AkkaPJ\target
[INFO]
[INFO] --- build-helper-maven-plugin:3.0.0:add-source (add-source) @ AkkaPJ ---
[INFO] Source directory: E:\git\AkkaPJ\src\main\java added.
[INFO] Source directory: E:\git\AkkaPJ\src\main\scala added.
[INFO]
[INFO] --- build-helper-maven-plugin:3.0.0:add-test-source (add-test-source) @ AkkaPJ ---
[INFO] Test Source directory: E:\git\AkkaPJ\src\test\java added.
[INFO] Test Source directory: E:\git\AkkaPJ\src\test\scala added.
[INFO]
[INFO] --- build-helper-maven-plugin:3.0.0:add-resource (add-resource) @ AkkaPJ ---
[INFO]
[INFO] --- build-helper-maven-plugin:3.0.0:add-test-resource (add-test-resource) @ AkkaPJ ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ AkkaPJ ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ AkkaPJ ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 2 source files to E:\git\AkkaPJ\target\classes
[INFO]
[INFO] --- scala-maven-plugin:3.3.1:add-source (compile-scala) @ AkkaPJ ---
[INFO]
[INFO] --- scala-maven-plugin:3.3.1:compile (compile-scala) @ AkkaPJ ---
[WARNING] Expected all dependencies to require Scala version: 2.11.8
[WARNING] com.citi.sky:AkkaPJ:0.0.1-SNAPSHOT requires scala version: 2.11.8
[WARNING] com.citi.sky:AkkaPJ:0.0.1-SNAPSHOT requires scala version: 2.11.8
[WARNING] org.scala-lang:scala-compiler:2.11.8 requires scala version: 2.11.8
[WARNING] org.scala-lang.modules:scala-xml_2.11:1.0.4 requires scala version: 2.11.4
[WARNING] Multiple versions of scala libraries detected!
[INFO] E:\git\AkkaPJ\src\main\java:-1: info: compiling
[INFO] E:\git\AkkaPJ\src\main\scala:-1: info: compiling
[INFO] Compiling 5 source files to E:\git\AkkaPJ\target\classes at 1517634353428
[INFO] prepare-compile in 0 s
[INFO] compile in 2 s
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ AkkaPJ ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 1 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ AkkaPJ ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to E:\git\AkkaPJ\target\test-classes
[INFO]
[INFO] --- scala-maven-plugin:3.3.1:add-source (test-compile-scala) @ AkkaPJ ---
[INFO]
[INFO] --- scala-maven-plugin:3.3.1:testCompile (test-compile-scala) @ AkkaPJ ---
[WARNING] Expected all dependencies to require Scala version: 2.11.8
[WARNING] com.citi.sky:AkkaPJ:0.0.1-SNAPSHOT requires scala version: 2.11.8
[WARNING] com.citi.sky:AkkaPJ:0.0.1-SNAPSHOT requires scala version: 2.11.8
[WARNING] org.scala-lang:scala-compiler:2.11.8 requires scala version: 2.11.8
[WARNING] org.scala-lang.modules:scala-xml_2.11:1.0.4 requires scala version: 2.11.4
[WARNING] Multiple versions of scala libraries detected!
[INFO] E:\git\AkkaPJ\src\test\java:-1: info: compiling
[INFO] E:\git\AkkaPJ\src\test\scala:-1: info: compiling
[INFO] Compiling 20 source files to E:\git\AkkaPJ\target\test-classes at 1517634355968
[WARNING] warning: there were 10 feature warnings; re-run with -feature for details
[WARNING] one warning found
[INFO] prepare-compile in 0 s
[INFO] compile in 4 s
[INFO]
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ AkkaPJ ---
[INFO] Surefire report directory: E:\git\AkkaPJ\target\surefire-reports
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.12.4/surefire-junit4-2.12.4.pom
[INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.12.4/surefire-junit4-2.12.4.pom (3 KB at 1.9 KB/sec)
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-providers/2.12.4/surefire-providers-2.12.4.pom
[INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-providers/2.12.4/surefire-providers-2.12.4.pom (3 KB at 6.1 KB/sec)
[INFO] Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.12.4/surefire-junit4-2.12.4.jar
[INFO] Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire-junit4/2.12.4/surefire-junit4-2.12.4.jar (37 KB at 56.6 KB/sec)
-------------------------------------------------------
T E S T S
-------------------------------------------------------
Results :
Tests run: 0, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ AkkaPJ ---
[INFO] Building jar: E:\git\AkkaPJ\target\AkkaPJ-0.0.1-SNAPSHOT.jar
[INFO]
[INFO] --- maven-shade-plugin:3.0.0:shade (default) @ AkkaPJ ---
[INFO] Including org.scala-lang:scala-library:jar:2.11.8 in the shaded jar.
[INFO] Including org.scala-lang:scala-compiler:jar:2.11.8 in the shaded jar.
[INFO] Including org.scala-lang.modules:scala-xml_2.11:jar:1.0.4 in the shaded jar.
[INFO] Including org.scala-lang.modules:scala-parser-combinators_2.11:jar:1.0.4 in the shaded jar.
[INFO] Including org.scala-lang:scala-reflect:jar:2.11.8 in the shaded jar.
[INFO] Including com.typesafe.akka:akka-actor_2.11:jar:2.5.9 in the shaded jar.
[INFO] Including com.typesafe:config:jar:1.3.2 in the shaded jar.
[INFO] Including org.scala-lang.modules:scala-java8-compat_2.11:jar:0.7.0 in the shaded jar.
[INFO] Attaching shaded artifact.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 15.142 s
[INFO] Finished at: 2018-02-03T13:06:06+08:00
[INFO] Final Memory: 27M/317M
[INFO] ------------------------------------------------------------------------
Scala和Java混合项目搭建:(Eclipse)的更多相关文章
- Intellij IDEA Java web 项目搭建
Java web 项目搭建 简介 在上一节java web环境搭建中,我们配置了开发java web项目最基本的环境,现在我们将采用Spring MVC+Spring+Hibernate的架构搭建一个 ...
- Java web 项目搭建
Java web 项目搭建 简介 在上一节java web环境搭建中,我们配置了开发java web项目最基本的环境,现在我们将采用Spring MVC+Spring+Hibernate的架构搭建一个 ...
- 实验一 Java环境的搭建&Eclipse的安装
本次实验为在自己电脑上搭建Java环境,熟悉Java的编译和运行环境并安装Eclipse 一.JAVA环境的搭建 1.从Oracle网站上下载Java的jdk [https://www.oracle. ...
- Maven项目搭建-Eclipse版
一.Maven简单介绍 Maven是基于Java平台的项目构建(mvn clean install).依赖管理(中央仓库,Nexus)和项目信息管理的项目管理工具. Maven是基于项目对象模型(PO ...
- Java Web项目搭建过程记录(struts2)
开发工具:eclipse 搭建环境:jdk1.7 tomcat 8.0 基础的java开发环境搭建过程不再赘述,下面从打开eclipse 之后的操作开始 第一步: 创建项目,File -> ...
- 一个简单的Java Web项目搭建流程
今天试图在服务器上搭建一个web服务器,顺便回顾了java web项目的入门,使用Servlet处理HTTP请求,并记录日志等操作.当很久没有做过web项目时,有些东西还是很容易忘记的. Maven配 ...
- 带领技术小白入门——基于java的微信公众号开发(包括服务器配置、java web项目搭建、tomcat手动发布web项目、微信开发所需的url和token验证)
微信公众号对于每个人来说都不陌生,但是许多人都不清楚是怎么开发的.身为技术小白的我,在闲暇之余研究了一下基于java的微信公众号开发.下面就是我的实现步骤,写的略显粗糙,希望大家多多提议! 一.申请服 ...
- Java web项目搭建系列之一 Eclipse中新建Maven项目
前提条件: 已经安装好JDK 已经安装好Maven 已经安装好Eclipse 已经安装好Maven插件 在Eclipse中新建Maven项目 [File]→[New]→[Other...] [Mave ...
- MyEclipse开发的java web项目在 Eclipse中无法识别
不能识别项目解决办法 在eclipse下,右键项目properties -> project fac e ts 选中 Dynamic web module 选择后面的版本为 2.5(运行环 ...
随机推荐
- Python和Sublime安装教程
Python安装 安装python可以去https://www.python.org官网下载 点开官网后点击下图我圈出来的地方 然后翻到页面最后,选择要安装的版本 点击下载后打开,将 Add Pyt ...
- 2019nc#3
题号 标题 已通过代码 题解/讨论 通过率 团队的状态 A Graph Games 点击查看 进入讨论 18/292 未通过 B Crazy Binary String 点击查看 1107/3615 ...
- HDU - 4305 - Lightning 生成树计数 + 叉积判断三点共线
HDU - 4305 题意: 比较裸的一道生成树计数问题,构造Krichhoof矩阵,求解行列式即可.但是这道题还有一个限制,就是给定的坐标中,两点连线中不能有其他的点,否则这两点就不能连接.枚举点, ...
- 题解 洛谷P1196 【[NOI2002]银河英雄传说】
题意 有一个划分成n列的星际战场,各列编号为1,2.....n.有n艘战舰,也依次编号1,2.....n,其中第i号战舰位于第i列. 有m条指令,每条指令格式如下 M i j 表示让第i号战舰所在列的 ...
- js中的所有兼容问题总结
js兼容问题总结 在学习js过程中很多人都遇到过兼容问题,这些兼容问题是因为各版本浏览器不同导致的,为了解决这些兼容问题,js给我们提供了解决这些兼容问题的方案,对此,我个人进行了汇集以及总结. ...
- 堆实战(动态数据流求top k大元素,动态数据流求中位数)
动态数据集合中求top k大元素 第1大,第2大 ...第k大 k是这群体里最小的 所以要建立个小顶堆 只需要维护一个大小为k的小顶堆 即可 当来的元素(newCome)> 堆顶元素(small ...
- MySQL EXPLAIN结果集分析 - 附带大量案例
大量实例助你看懂Explain的输出内容,轻松搞定慢查询 EXPLAIN:查看SQL语句的执行计划 EXPLAIN命令可以帮助我们深入了解MySQL基于开销的优化器,还可以获得很多可能被优化器考虑到的 ...
- 基于GitLab+Jenkins的DevOps赋能实践
随着微服务.中台架构的兴起,DevOps也变得非常关键,毕竟是一些基础设施层面的建设,如果搞好了对后面的研发工作会有很大的效率提升.关于DevOps本身的概念,网上已经非常多了,在园子里随便搜索一些都 ...
- 基于Selenium+Python的web自动化测试框架
一.什么是Selenium? Selenium是一个基于浏览器的自动化测试工具,它提供了一种跨平台.跨浏览器的端到端的web自动化解决方案.Selenium主要包括三部分:Selenium IDE.S ...
- Javaweb设置session过期时间
在Java Web开发中,Session为我们提供了很多方便,Session是由浏览器和服务器之间维护的.Session超时理解为:浏览器和服务器之间创建了一个Session,由于客户端长时间(休眠时 ...