基于Eclipse的Storm应用开发
2015-12-10 11:00
447 查看
1、基于Maven的开发
1.1 先给Eclipse安装Maven插件,可以参考文档点击打开链接,文档中描述的是离线安装插件。我们可以选择在线安装,Eclipse中Help->Eclipse MarketPlace在Find中属于Maven,选择“Maven
Integration for Eclipse”插件进行安装。其他设置可以参考链接文档中的设置。
1.2 创建工程时就可以选择Maven Project
1.3 创建完工程后,需要编辑pom.xml,在project标签下面写入如下内容,当你保存时,Maven会自动从远程中心库中下载相关依赖包。
<repositories>
<repository>
<id>clojars.org</id>
<url>http://clojars.org/repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-core</artifactId>
<version>0.9.1-incubating</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<includeProjectDependencies>true</includeProjectDependencies>
<includePluginDependencies>false</includePluginDependencies>
<classpathScope>compile</classpathScope>
<mainClass>${main.class}</mainClass>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<descriptorRefs>
<descriptroRef>jar-with-dependencies</descriptroRef>
</descriptorRefs>
<archive>
<manifest><mainClass></mainClass></manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
2、基于非Maven的开发
2.1 需要将Storm源码中lib文件夹下的jar包都导入java工程
2.2 如果最后打jar包放到cluster中运行时,不能将这些jar包打进去,因为集群中已经有这些jar包了,会引起jar包冲突而报错。
1.1 先给Eclipse安装Maven插件,可以参考文档点击打开链接,文档中描述的是离线安装插件。我们可以选择在线安装,Eclipse中Help->Eclipse MarketPlace在Find中属于Maven,选择“Maven
Integration for Eclipse”插件进行安装。其他设置可以参考链接文档中的设置。
1.2 创建工程时就可以选择Maven Project
1.3 创建完工程后,需要编辑pom.xml,在project标签下面写入如下内容,当你保存时,Maven会自动从远程中心库中下载相关依赖包。
<repositories>
<repository>
<id>clojars.org</id>
<url>http://clojars.org/repo</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.storm</groupId>
<artifactId>storm-core</artifactId>
<version>0.9.1-incubating</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.2.1</version>
<executions>
<execution>
<goals>
<goal>exec</goal>
</goals>
</execution>
</executions>
<configuration>
<executable>java</executable>
<includeProjectDependencies>true</includeProjectDependencies>
<includePluginDependencies>false</includePluginDependencies>
<classpathScope>compile</classpathScope>
<mainClass>${main.class}</mainClass>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>2.2.1</version>
<configuration>
<descriptorRefs>
<descriptroRef>jar-with-dependencies</descriptroRef>
</descriptorRefs>
<archive>
<manifest><mainClass></mainClass></manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
2、基于非Maven的开发
2.1 需要将Storm源码中lib文件夹下的jar包都导入java工程
2.2 如果最后打jar包放到cluster中运行时,不能将这些jar包打进去,因为集群中已经有这些jar包了,会引起jar包冲突而报错。
相关文章推荐
- maven学习
- Release Notes - Apache Storm - Version 0.9.2-incub
- maven插件maven-war-plugin的使用
- jenkins------部署项目到jboss eap下
- maven使用经验集
- MyEclipse Web Project转Eclipse Dynamic Web Project
- Windows Clang开发环境备忘
- 傻瓜式用Eclipse连接MySQL数据库
- C/C++实现对STORM运行信息查看及控制的方法
- Eclipse引入jquery报错如何解决
- 让Flex Builder 3.0与Eclipse3.4整合起来
- Eclipse配置Javascript开发环境图文教程
- 使用zend studio for eclipse不能激活代码提示功能的解决办法
- 图解Eclipse j2ee开发环境的搭建过程
- 两种Eclipse部署动态web项目方法
- ext for eclipse插件安装方法
- 解决Fedora14下eclipse进行android开发,ibus提示没有输入窗口的方法详解
- eclipse导入jquery包后报错的解决方法
- Eclipse 格式化代码时不换行与自动换行的实现方法
- Eclipse下jQuery文件报错出现错误提示红叉