在eclipse建立一个scala 的meven工程,需要使用的模板是
-DarchetypeGroupId=org.scala-tools.archetypes \
-DarchetypeArtifactId=scala-archetype-simple
然后,会遇到几个问题:
1,maven的模板是什么,这个通过上述的文字已经解决。
2,Maven报Plugin execution not covered by lifecycle configuration,这个问题通过pluginManagement来解决,详见参考链接。
3,通常,maven只能够建立一个java工程,这时候,需要进行如下操作,变成一个scala工程
project name --> Configure --> Add scala nature
eclipse scala IDE自带的scala包就被加进来了,这个工程就是scala工程。详见参考链接。
4,scala IDE的scala包的版本通常与pom里面的版本并不一样,所以要把Pom里面的版本的版本号做一个修改,具体那个版本要看具体情况。要把第三方包的一些scala的依赖给去除掉
如
<exclusions>
<exclusion>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
</exclusion>
</exclusions>
配置好之后三个文件如下:
.classpath
<?xml version="1.0" encoding="UTF-8"?> <classpath> <classpathentry kind="src" output="target/classes" path="src/main/scala"> <attributes> <attribute name="optional" value="true"/> <attribute name="maven.pomderived" value="true"/> </attributes> </classpathentry> <classpathentry kind="src" output="target/test-classes" path="src/test/scala"> <attributes> <attribute name="optional" value="true"/> <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="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"> <attributes> <attribute name="maven.pomderived" value="true"/> </attributes> </classpathentry> <classpathentry kind="output" path="target/classes"/> </classpath>
.project
<?xml version="1.0" encoding="UTF-8"?> <projectDescription> <name>beginscala</name> <comment></comment> <projects> </projects> <buildSpec> <buildCommand> <name>org.scala-ide.sdt.core.scalabuilder</name> <arguments> </arguments> </buildCommand> <buildCommand> <name>org.eclipse.m2e.core.maven2Builder</name> <arguments> </arguments> </buildCommand> </buildSpec> <natures> <nature>org.scala-ide.sdt.core.scalanature</nature> <nature>org.eclipse.jdt.core.javanature</nature> <nature>org.eclipse.m2e.core.maven2Nature</nature> </natures> </projectDescription>
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/maven-v4_0_0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.thomas</groupId> <artifactId>beginscala</artifactId> <version>0.0.1-SNAPSHOT</version> <name>${project.artifactId}</name> <description>My wonderfull scala app</description> <inceptionYear>2010</inceptionYear> <licenses> <license> <name>My License</name> <url>http://....</url> <distribution>repo</distribution> </license> </licenses> <properties> <maven.compiler.source>1.5</maven.compiler.source> <maven.compiler.target>1.5</maven.compiler.target> <encoding>UTF-8</encoding> <scala.version>2.11.2</scala.version> <specs.version>2.9.0</specs.version> </properties> <!-- <repositories> <repository> <id>scala-tools.org</id> <name>Scala-Tools Maven2 Repository</name> <url>http://scala-tools.org/repo-releases</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>scala-tools.org</id> <name>Scala-Tools Maven2 Repository</name> <url>http://scala-tools.org/repo-releases</url> </pluginRepository> </pluginRepositories> --> <dependencies> <!-- Test --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.1</version> <scope>test</scope> </dependency> <dependency> <groupId>org.scala-tools.testing</groupId> <artifactId>specs_${specs.version}</artifactId> <version>1.6.8</version> <scope>test</scope> <exclusions> <exclusion> <groupId>org.scala-lang</groupId> <artifactId>scala-library</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.scalatest</groupId> <artifactId>scalatest</artifactId> <version>1.2</version> <scope>test</scope> </dependency> </dependencies> <build> <sourceDirectory>src/main/scala</sourceDirectory> <testSourceDirectory>src/test/scala</testSourceDirectory> <pluginManagement> <plugins> <plugin> <groupId>org.scala-tools</groupId> <artifactId>maven-scala-plugin</artifactId> <version>2.15.0</version> <executions> <execution> <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> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>2.6</version> <configuration> <useFile>false</useFile> <disableXmlReport>true</disableXmlReport> <!-- If you have classpath issue like NoDefClassError,... --> <!-- useManifestOnlyJar>false</useManifestOnlyJar --> <includes> <include>**/*Test.*</include> <include>**/*Suite.*</include> </includes> </configuration> </plugin> </plugins> </pluginManagement> </build> </project>
reference
http://my.oschina.net/aaaaaaaa/blog/12473
http://blog.csdn.net/xxd851116/article/details/25197373
http://stackoverflow.com/questions/3243984/scala-ide-error-projectname-is-not-a-scala-project
http://scala-ide.org/docs/current-user-doc/faq/index.html
相关推荐
为Java,Scala,Scala.macro,Scala.js,Scala.native,Eclipse和Maven构建集成器。 安装 生产发布 开发发布 适用于Scala IDE 4.7的Scalor插件1.X 相似的插件 入门 设置 建立并研究 插件功能 Scala 新增量 使用...
这是生态系统构建器,这是一个基于的系统,它使用Scala-IDE在Eclipse,Scala和Scala-IDE的特定风味之外,在Eclipse更新站点内构建和集成与Scala相关的插件。 该项目源的最新版本托管在: : 遗产 stable-scala-ide-...
基于 Scala IDE 的 Eclipse 插件的 Giter8 模板。 此模板生成 5 个 Eclipse 插件: 插件本身 plugin.tests片段 Eclipse 功能 Eclipse 源功能 Eclipse 更新站点 这些项目可以很容易地导入到 Eclipse 中。 此外,您...
Eclipse+Maven+Scala Project+Spark | 编译并打包wordcount程序 学习用Eclipse+Maven来构建并打包一个简单的单词统计的例程。 第一步 在EclipseIDE中安装Scala插件 在Eclipse中安装Scala插件 第二步 创建Scala ...
在 Linux 机器上工作没有问题) SBT 下载并解压,(适用于 0.13.7) Eclipse 与 Scala-ide(适用于 Eclipse Luna 和 Scala-ide 4.0.0) 插件 m2eclipse-scala 如果您打算使用 Maven 而不是 SBT 安装从下载最新版本...
java图书馆swing源码m2eclipse-scala 是一项正在进行的工作,以简化 和 之间的集成。 问题跟踪器: 邮件列表 : 更新站点: 以前版本的更新站点遵循模式:.. 工作配置 通过将示例项目导入 Eclipse 来“验证”插件: ...
JavaScala集成 在椭圆上安装 Scala IDE 适用于Eclipse的Maven Scala插件 将此项目导入为Maven项目
编码将 IDE 配置为对所有文件使用 UTF-8 通过将“-Dfile.encoding=UTF-8”添加到 $MAVEN_OPTS 来配置 Maven 集成开发环境Intellij IDEA 支持 Maven 开箱即用 Maven 通过m2e 插件在 Eclipse 中得到支持,包括在一些 ...
链接预测火花TU-Berlin AIM3 课程项目 - 在 Scala 和 Java 中使用 Apache Spark 进行链接预测Eclipse 项目设置:Eclipse Luna + Scala IDE - 从 Scala 网站下载并带有预配置的 maven 插件项目->属性->Scala编译器...
这使得在 IDE 中开发的代码能够利用已有的机制来构建,从而尽可能的减少了在新环境中使用所受的干预,哪怕与那些没有安装 Kotlin 插件的开发人员一起合作项目也没有问题。 The IntelliJ Kotlin 插件扩展了 Java ...
在IDE(Eclipse)中实现Flink cd ~/Downloads git clone https://github.com/apache/flink.git cd flink mvn clean package -DskipTests 将“ macroparadise”编译器插件添加到Scala编译器。 打开“窗口” - >...
加载到 IDE 如果您使用的是 eclipse,请运行 mvn eclipse:eclipse然后将项目加载到eclipse。 如果您使用的是 Intellij,只需将项目加载为 Maven 项目。4. 最新请在来会话之前拉以获取最新代码。
要求Maven 3.2.5 => 使用互联网连接JDK 1.8.0u45 Scala 2.11.6 一个很酷的 IDE,支持 scala 和 java (Intellij IDEA, Eclipse)脚步签出项目并使其在您喜欢的 IDE 中构建。 启动 Springboot 应用程序 ...
或者,将项目导入Java IDE(例如IDEA或Eclipse,或您喜欢的VS Code)中,并使用gradle插件(如果有)。跑在您的CLI中,键入java -jar build/libs/decaf.jar -h 显示使用帮助。 可能的目标/任务是: PA1:解析源代码...