java要多思考下

成长^_^

   ::  :: 新随笔 ::  ::  :: 管理 ::
  33 随笔 :: 0 文章 :: 19 评论 :: 0 Trackbacks
1、创建项目目录结构
    project/common/branches(注:公共项目)
                           /tags 
                           /trunk/src/main/java
                                                 /resources                                           
                                         /test/java
                                                /resources
                                   /pom.xml
             /sso/branches(注:单点登录)
                   /tags 
                   /trunk/src/main/java
                                         /resources                                           
                                 /test/java
                                        /resources
                                        /WebContent
                            /pom.xml
2、编写pom.xml,代码片段
 1 
 2 <modelVersion>4.0.0</modelVersion>
 3   <groupId>com.cd</groupId>
 4   <artifactId>sso</artifactId>
 5   <packaging>war</packaging>
 6   <version>1.0</version>
 7   
 8   <properties>
 9     <hession.version>3.1.5</hession.version>
10       <spring.version>3.0.5.RELEASE</spring.version>
11       <jackson.version>1.7.1</jackson.version>
12       <mybatis.version>3.0.3</mybatis.version>
13       <redis.version>1.5.2</redis.version>
14       <mysql.version>5.1.14</mysql.version>
15       <org.slf4j.version>1.6.1</org.slf4j.version>
16       <quartz.version>1.5.2</quartz.version>
17     <mail.version>1.4</mail.version>
18       <buildDirectory>../../../build/sso</buildDirectory>
19       <sourceDirectory>src</sourceDirectory>
20       <fileName>sso</fileName>
21       <profile>dev</profile>
22       <cd.common.version>1.0</cd.common.version>    
23   </properties>
24   
25   <build>  
26     <directory>${buildDirectory}</directory>
27     <finalName>${fileName}</finalName>
28     <sourceDirectory>${sourceDirectory}</sourceDirectory>
29     
30     <plugins>
31         <plugin>
32             <groupId>org.apache.maven.plugins</groupId>
33             <artifactId>maven-antrun-plugin</artifactId>
34             <version>1.6</version>
35             <executions>
36               <execution>
37                 <id>compile</id>
38                 <phase>compile</phase>
39                 <configuration>
40                   <target>
41                   </target>
42                 </configuration>
43                 <goals>
44                   <goal>run</goal>
45                 </goals>
46               </execution>
47             </executions>
48         </plugin>
49         
50         <plugin>
51             <artifactId>maven-compiler-plugin</artifactId>
52             <version>2.3.2</version>
53             <configuration>
54                 <source>1.6</source>
55                 <target>1.6</target>
56                 <encoding>UTF-8</encoding>
57             </configuration>
58         </plugin>
59         
60         <plugin>
61             <artifactId>maven-resources-plugin</artifactId>
62             <version>2.4.3</version>
63             <configuration><encoding>UTF-8</encoding></configuration>
64         </plugin>
65         
66         <plugin>
67             <artifactId>maven-war-plugin</artifactId>
68             <version>2.1.1</version>
69             <configuration>
70                 <warSourceDirectory>src/main/WebContent</warSourceDirectory>
71             </configuration>
72         </plugin>
73     </plugins>
74     
75     <resources>
76         <resource>  
77             <directory>src/main/resources</directory> 
78             <excludes>  
79                 <exclude>sql/*.*</exclude>
80                 <exclude>config/*.*</exclude>
81              </excludes>  
82         </resource>  
83     </resources> 
84   </build>    

3、使用mvn命令打包项目
mvn clean
mvn package

4、在eclipse中开发前的设置
    a、从svn库中check下cdcommon为普通java project
    b、check下sso位web project
    c、配置.classpath文件
 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <classpath>
 3     <classpathentry kind="src" path="src/main/java"/>
 4     <classpathentry kind="src" path="cdcommon"/>
 5     <classpathentry kind="src" path="src/main/resources"/>
 6     <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre6">
 7         <attributes>
 8             <attribute name="owner.project.facets" value="java"/>
 9         </attributes>
10     </classpathentry>
11     <classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v6.0">
12         <attributes>
13             <attribute name="owner.project.facets" value="jst.web"/>
14         </attributes>
15     </classpathentry>
16     <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
17     <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
18     <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/common-lib">
19         <attributes>
20             <attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
21         </attributes>
22     </classpathentry>
23     <classpathentry kind="output" path="build/classes"/>
24 </classpath>
25 
       d、配置.project文件
 1 <?xml version="1.0" encoding="UTF-8"?>
 2 <projectDescription>
 3     <name>sso</name>
 4     <comment></comment>
 5     <projects>
 6     </projects>
 7     <buildSpec>
 8         <buildCommand>
 9             <name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
10             <arguments>
11             </arguments>
12         </buildCommand>
13         <buildCommand>
14             <name>org.eclipse.jdt.core.javabuilder</name>
15             <arguments>
16             </arguments>
17         </buildCommand>
18         <buildCommand>
19             <name>org.eclipse.wst.common.project.facet.core.builder</name>
20             <arguments>
21             </arguments>
22         </buildCommand>
23         <buildCommand>
24             <name>org.eclipse.wst.validation.validationbuilder</name>
25             <arguments>
26             </arguments>
27         </buildCommand>
28     </buildSpec>
29     <natures>
30         <nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
31         <nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
32         <nature>org.eclipse.wst.common.project.facet.core.nature</nature>
33         <nature>org.eclipse.jdt.core.javanature</nature>
34         <nature>org.eclipse.wst.jsdt.core.jsNature</nature>
35     </natures>
36     <linkedResources>
37         <link>
38             <name>cdcommon</name>
39             <type>2</type>
40             <location>E:/work_space/cdcommon/src/main/java</location>
41         </link>
42     </linkedResources>
43 </projectDescription>
44 





posted on 2011-10-11 18:20 java要多思考下 阅读(974) 评论(0)  编辑  收藏 所属分类: 研发管理

只有注册用户登录后才能发表评论。


网站导航: