gpt4 book ai didi

scala - NetBeans + Scala + Maven

转载 作者:行者123 更新时间:2023-12-02 00:15:39 28 4
gpt4 key购买 nike

我是 Scala 的新手,也是 Java 的新手。我似乎无法通过 Scala 使用 IDE。我正在使用纯文本编辑器并使用 sbt,效果很好。但我想要代码提示,让 IDE 通过在 maven 中搜索它们来帮助我解析类。

我有适用于 NetBeans 的 Scala 插件,但它使用的是 ant。代码提示有效,但它不像使用 java/maven 那样为我解析类。

有没有办法通过 Maven 或 SBT 将 NetBeans 与 Scala 结合使用?

最佳答案

我不是 NetBeans 用户,但我想使用 maven 设置对其进行测试,对我来说,它与以下 pom 文件配合使用效果很好。

它使用 ScalaTest用于单元测试。

我刚刚通过选择 Open project... 并指向 pom 文件加载了这个项目。

<?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.stackoverflow.Q13337089</groupId>
<artifactId>scala</artifactId>
<version>1.0-SNAPSHOT</version>

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

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<scala.version>2.9.2</scala.version>
</properties>

<dependencies>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.9.2</artifactId>
<version>2.0.M4</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</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>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<executions>
<execution>
<id>default-test</id>
<!-- Disable the default-test by putting it in phase none -->
<phase>none</phase>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>1.0-M2</version>
<configuration>
<reportsDirectory>${project.build.directory}/surefire-reports</reportsDirectory>
<junitxml>.</junitxml>
<filereports>WDF TestSuite.txt</filereports>
<stdout>W</stdout> <!-- Skip coloring output -->
</configuration>
<executions>
<execution>
<id>scala-test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

关于scala - NetBeans + Scala + Maven,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13337089/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com