[liusy.api-SMJ]-MAVEN archetype 建立項目

•選擇或建立工做空間 Select a workspace
–File – Switch Workspace - other

•選擇或輸入空間目錄
•新空間配置編碼集合  UTF-8
•配置Maven setting 包含私庫配置的文件
–同時也修改系統MavenHome 的conf下Setting文件
settings.xml 配置私庫地址和認證信息。 成熟了會公開。
•系統Maven 配置文件查找
•查看配置是否有私庫內容
 
•JDK 1.7
 
•Installed JREs 配置爲 1.7
 
•對MAVEN 進行配置
這個設置,是防止出現驗證錯誤。
建立一個組件
•建立一個Parent POM 統必定義發佈配置
•建立一個Config工程,註冊控制類等配置
•建立一個DAO工程,配置鏈接JNDI數據庫池
•建立一個Service工程,實現業務及控制層
•直接修改,而且Existing Maven Project
  1 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  2     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  3     <modelVersion>4.0.0</modelVersion>
  4     <groupId>cn.shuyouliu</groupId>
  5     <artifactId>parent</artifactId>
  6     <packaging>pom</packaging>
  7     <properties>
  8         <spring.version>3.2.6.RELEASE</spring.version>
  9         <jetty.version>9.0.7.v20131107</jetty.version>
 10         <jersey.version>2.22.2</jersey.version>
 11         <logback.version>1.1.1</logback.version>
 12         <jcloverslf4j.version>1.7.6</jcloverslf4j.version>
 13         <shuyouliu.version>0.0.1-SNAPSHOT</shuyouliu.version>
 14     </properties>
 15     <version>0.0.1-SNAPSHOT</version>
 16 
 17     <name>parent</name>
 18     <description>liusy.api.manager</description>
 19     <inceptionYear>2016-2016</inceptionYear>
 20     <organization>
 21         <name>shuyouliu.cn</name>
 22         <url>http://shuyouliu.cn/</url>
 23     </organization>
 24 
 25     <developers>
 26         <developer>
 27             <id>shuyouliu</id>
 28             <name>shuyou.liu</name>
 29             <email>shuyouliu@126.com</email>
 30             <roles>
 31                 <role>Project leader</role>
 32             </roles>
 33             <timezone>+8</timezone>
 34         </developer>
 35     </developers>
 36 
 37     <licenses>
 38         <license>
 39             <name>Apache License, Version 2.0</name>
 40             <url>http://www.apache.org/licenses/LICENSE-2.0</url>
 41         </license>
 42     </licenses>
 43     <dependencies>
 44         <dependency>
 45             <groupId>org.springframework</groupId>
 46             <artifactId>spring-core</artifactId>
 47             <version>${spring.version}</version>
 48         </dependency>
 49 
 50         <dependency>
 51             <groupId>org.springframework</groupId>
 52             <artifactId>spring-context</artifactId>
 53             <version>${spring.version}</version>
 54             <exclusions>
 55                 <exclusion>
 56                     <groupId>commons-logging</groupId>
 57                     <artifactId>commons-logging</artifactId>
 58                 </exclusion>
 59             </exclusions>
 60         </dependency>
 61         <dependency>
 62             <groupId>junit</groupId>
 63             <artifactId>junit</artifactId>
 64             <version>3.8.1</version>
 65             <scope>test</scope>
 66         </dependency>
 67         <!-- LogBack dependencies -->
 68         <dependency>
 69             <groupId>ch.qos.logback</groupId>
 70             <artifactId>logback-classic</artifactId>
 71             <version>${logback.version}</version>
 72         </dependency>
 73         <dependency>
 74             <groupId>org.slf4j</groupId>
 75             <artifactId>jcl-over-slf4j</artifactId>
 76             <version>${jcloverslf4j.version}</version>
 77         </dependency>
 78 
 79 
 80     </dependencies>
 81     <modules>
 82         <module>../web</module>
 83         <module>../html</module>
 84         <module>../upload</module>
 85         <module>../errorJson</module>
 86         <module>../common</module>
 87         
 88         <module>../service</module>
 89         <module>../dao</module>
 90     </modules>
 91 
 92     <!-- 設定主倉庫,按設定順序進行查找。 -->
 93     <repositories>
 94         <repository>
 95             <id>nexus-repos</id>
 96             <name>Team Nexus Repository</name>
 97             <url>http://192.168.4.11:8085/nexus/content/groups/public/</url>
 98             <releases>
 99                 <enabled>true</enabled>
100             </releases>
101             <snapshots>
102                 <enabled>true</enabled>
103             </snapshots>
104         </repository>
105     </repositories>
106     <!-- 設定插件倉庫 -->
107     <pluginRepositories>
108         <pluginRepository>
109             <id>nexus-repos</id>
110             <name>Team Nexus Repository</name>
111             <url>http://192.168.4.11:8085/nexus/content/groups/public/</url>
112             <releases>
113                 <enabled>true</enabled>
114             </releases>
115             <snapshots>
116                 <enabled>true</enabled>
117             </snapshots>
118         </pluginRepository>
119     </pluginRepositories>
120     <!-- 部署管理 -->
121     <distributionManagement>
122         <repository>
123             <id>user-release</id>
124             <name>User Project Release</name>
125             <url>http://192.168.4.11:8085/nexus/content/repositories/releases/</url>
126         </repository>
127 
128         <snapshotRepository>
129             <id>user-snapshots</id>
130             <name>User Project SNAPSHOTS</name>
131             <url>http://192.168.4.11:8085/nexus/content/repositories/snapshots/</url>
132         </snapshotRepository>
133     </distributionManagement>
134 
135 
136 </project>
須要調整group id等信息
 
建立一個Config工程
配置私庫(一次)
http://119.253.41.173:58085/nexus/service/local/repositories/snapshots/content/archetype-catalog.xml
若是有變化,能夠留言我。 或到   https://github.com/shuyouliu/liusy.api 中尋找下。
 
Zyhao author.config…
配置中心
•模板生成的工程 (須要調整。)
 
刪除多餘文件,修改Pom內容
 
•Pom Parent配置能夠不加
建立一個DAO
 
https://github.com/shuyouliu/liusy.api/blob/master/dao/howto.md  數據庫相關的配置說明。
建立 .service
.service 運行
 
相關文章
相關標籤/搜索