Bạn sẽ có thể sử dụng mvn archetype:generate
. Bạn có thể chọn, ví dụ: org.scala-tools.archetypes:scala-archetype-simple
. Bạn cần phải đặt số thứ tự bên cạnh tên nguyên mẫu trong đầu ra của lệnh mvn archetype:generate
của bạn vì việc đánh số có thể thay đổi theo thời gian. Ngoài ra còn có các tùy chọn khác như eu.stratosphere:quickstart-scala
như được ghi trong this article.
Chúng có thể hơi lỗi thời. Cá nhân tôi thích viết các tệp pom.xml
của tôi theo cách thủ công. Để tham khảo, đây là tệp pom tối thiểu để sử dụng với Scala 2.11.6 và Scalatest 2.2.5:
<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.example</groupId>
<artifactId>my-artifact</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<encoding>UTF-8</encoding>
<scala.version>2.11.6</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.11</artifactId>
<version>2.2.5</version>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.scala-tools</groupId>
<artifactId>maven-scala-plugin</artifactId>
<version>2.15.2</version>
<executions>
<execution>
<goals>
<goal>compile</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
</configuration>
<executions>
<execution>
<id>test</id>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Bạn đã thử các bước ở đây chưa? http://docs.scala-lang.org/tutorials/scala-with-maven.html –
http://docs.scala-lang.org/tutorials/scala-with-maven.html#creating-your-first- dự án –
Đã thử nó, 339 bây giờ là một số dự án Java khác: '339: remote -> com.yoctopuce.archetype: commandline (Ví dụ dòng lệnh đơn giản với thư viện Yoctoupce)' – shakedzy