-
Mac
官网的安装包需要从仓库下载文件,容易超时。
下载页面下方有几个链接,可以选择OBEO下载离线安装包。
4.7 Oxygen
4.6 Neon
点击 Help -> Install New Software
,搜索关键字后选择指定包安装,可能比较慢。
创建 Maven 项目:File -> New -> Other -> Maven -> Maven Project
在项目上点击右键,然后选择 maven -> update project -> Force Update of Snapshots/Releases
在项目上点击右键,然后选择 Run As -> Maven build...
,在 Goals
中输入命令,比如 compile
。
下次选择 Maven build
即可在执行历史中直接选择。
在 pom.xml
增加插件,内容如下:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<archive>
<manifest>
<mainClass>org.mycompany.app.learn_mahout.Recommender</mainClass> <!-- 必须有 -->
</manifest>
</archive>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
</plugin>
</plugins>
</build>
然后执行 mvn clean compile assembly:single -Dmaven.test.skip=true
,将在 target
目录下生成 *-jar-with-dependencies.jar
。
想运行程序就执行:java -jar *-jar-with-dependencies.jar
。