Virgo Project-GreenPages Sample开发部署
1.开发环境
?? JDK1.6.0_26,virgo-tomcat-server-3.0.0.RELEASE,Maven3.0.3,Eclipse Virgo Tooling
2.部署运行
?? (1)下载:http://eclipse.org/virgo/download/
?? prompt> mkdir c:\springsource\samples
?? prompt> cd c:\springsource\samples
?? prompt> jar xf c:\path\to\greenpages-2.4.0.RELEASE.zip
?? (2)打包:
?? cd D:\TempWorkspace\greenpages-2.4.0.RELEASE\solution
?? mvn package
?? (3)安装依赖至Virgo Tomcat Server
?? 执行上述命令时mvn 使用dependency:copy-dependencies插件搜集GreenPages工程所需要的所有依赖Bundle
?? (Virgo Tomcat Server不支持的),执行完package阶段后,这些第三方的依赖Bundle可在D:\TempWorkspace
?? \greenpages-2.4.0.RELEASE\solution\greenpages\target\par-provided下找到,需要将这些JAR拷贝至
?? Virgo? Tomcat Server下的/repository/usr目录下。
?
??? Notice that Virgo Tomcat Server will not necessarily see these dependencies unless its repository
??? indexes are rebuilt. Different repositories behave differently in this respect; some are passive
??? (their indexes are built only once upon startup) and some are active (they can detect new files or
??? files being removed dynamically). The usr repository is active so there is no need to restart
??? Virgo Tomcat Server when copying these files. The next time Virgo Tomcat Server is started the
??? -clean option will cause Virgo Tomcat Server to re-scan the repository directories in any case.
??? It is always safe to start Virgo Tomcat Server with the -clean option.
??? (4)配置数据库
??? 切换至:D:\TempWorkspace\greenpages-2.4.0.RELEASE\db,运行:run
??? 启动会数据库后在执行该目录下的data.bat脚本,插入数据:data
??? (5)安装GreenPages
??? 复制greenpages-solution-2.4.0.RELEASE.par至Virgo Tomcat Server 下的pickup目录:
??? prompt> cd %SERVER_HOME%
??? prompt> copy %GREENPAGES_HOME%\solution\greenpages\target\greenpages-solution-?
??? 2.4.0.RELEASE.par pickup\
??? 启动Virgo Tomcat Server With "-claen":
??? prompt> "%SERVER_HOME%"\bin\startup.bat -clean
??? 查看控制台的输出日志信息,检验GreenPages工程启动:
??? <DE0005I> Started par 'greenpages' version '2.4.0.RELEASE'.
3. 从Eclipse(STS)中运行GreenPages
??? (1)Import Green Pages工程
??? (2)配置Virgo Tomcat Server Target Runtime
??? 在Server视图中,配置Virgo Tomcat Server,指定JDK为JAVA_HOME中的JDK;
??? (3)运行GreenPages
??? Right click on the Virgo Tomcat Server instance in the Servers view and select the Add and
??? Remove… menu item;
??? Add greenpages-solution (which is the containing project or PAR) to the server and finish.
4. 解决Greenpages工程的部署问题:
??? Can't build Greenpages 2.4.0.RELEASE with an empty Maven cache
??? (1) 在solution\greenpages\下新建一个空的的template.mf文件;
??? (2) 在solution\greenpages\下新建目录结构:src\main\resources
??? (3) 修改parent工程的pom.xml文件:
??? <plugin>
?????????? <groupId>com.springsource.bundlor</groupId>
?????????? <artifactId>com.springsource.bundlor.maven</artifactId>
?????????? <version>1.0.0.RELEASE</version>
?? ? ? ??? <executions>
??????????????? <execution>
???????????????????? <id>bundlor</id>
???????????????????? <goals>
???????????????????????? <goal>bundlor</goal>
???????????????????? </goals>
???????????????????? <phase>package</phase>
??????????????? </execution>
?????????? </executions>
???? </plugin>
??? (4) 修改web工程的pom.xml文件中的maven-war-plugin插件:
??? <plugins>
? ? ? ? ?? <plugin>
? ? ? ? ? ? ? ?? <artifactId>maven-war-plugin</artifactId>
???????????????? <version>2.2</version>
???????????????? <configuration>
??????????????????????? <packagingExcludes>WEB-INF/lib/**</packagingExcludes>
???????????????? </configuration>
??????????? </plugin>
???? </plugins>
?? (5) 修改preenpages工程下的pom.xml文件
?? <plugin>
??????? <groupId>org.apache.maven.plugins</groupId>
??????? <artifactId>maven-dependency-plugin</artifactId>
???? ?? <configuration>
??????????????? <outputDirectory>${project.build.directory}/par-provided</outputDirectory>
??????????????? <overWriteIfNewer>true</overWriteIfNewer>
??????????????? <excludeGroupIds>org.eclipse.virgo,org.apache.log4j</excludeGroupIds>
??????? </configuration>
??????? <executions>
??????????????? <execution>
??????????????????? <id>copy-dependencies</id>
??????????????????? <phase>package</phase>
??????????????????? <goals>
????? ? ? ? ? ? ? ? ? ? <goal>copy-dependencies</goal>
??????????????????? </goals>
?????????????? </execution>
????????? </executions>
???? </plugin>
??? (6) 执行命令进行打包
??? mvn package -Dmaven.test.skip=true