我正在使用Indigo Release of eclipse.当我检查Window - > Preferences,Maven - > Installations时,它确认它正在使用Maven的Embedded(3.0.2/...)安装.
我希望能够从命令行(Windows Powershell)运行maven命令,但是当我键入时,例如,
PS C:\> mvn
Run Code Online (Sandbox Code Playgroud)
找不到可执行文件.我搜索了"mvn.exe",但未找到任何结果.
我想我可以安装一个独立版本的Maven 3并将其添加到我的PATH中,但我更喜欢使用相同的Maven安装来执行命令行任务以及IDE(eclipse)任务.
那么,嵌入式maven的mvn.exe隐藏在哪里?
我创建了一个新的scala项目,其中包含以下内容:
mvn org.apache.maven.plugins:maven-archetype-plugin:2.2:generate
-DarchetypeGroupId=org.scala-tools.archetypes
-DarchetypeArtifactId=scala-archetype-simple
-DarchetypeVersion=1.3
-DgroupId=myGroup
-DartifactId=myProject
-Dversion=0.1.0
-DinteractiveMode=false
Run Code Online (Sandbox Code Playgroud)
这给了我以下POM:
<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>myGroup</groupId>
<artifactId>myProject</artifactId>
<version>0.1.0</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.8.0</scala.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>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>${scala.version}</version>
</dependency>
<!-- 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_${scala.version}</artifactId>
<version>1.6.5</version>
<scope>test</scope> …
Run Code Online (Sandbox Code Playgroud) 我试图做一些看似相当简单的事情:总结一组列表的大小.Netbeans给出以下警告/错误:
actual argument java.util.ArrayList<java.util.TreeSet<java.lang.Integer>> cannot be converted to java.util.List<java.util.Set<java.lang.Object>> by method invocation conversion
Run Code Online (Sandbox Code Playgroud)
对于以下两段代码:
/**
* Sums the sizes of all sets in a list. Note that while there will be
* no duplicate elements in a single set, "sister" sets may contain
* elements, so the value returned is **not** equal to the number of unique
* elements in all sets.
* @param list, a List of Sets
* @return the number of elements contained in all sets
*/ …
Run Code Online (Sandbox Code Playgroud)