Skip to content

Commit 8b7fd3e

Browse files
committed
Merge pull request apache#15 from kangfoo/2dangdang
基于dubbo-demo新建maven archetype模块以便于快速搭建dubbox rest 项目工程
2 parents d59d725 + 80481c6 commit 8b7fd3e

File tree

65 files changed

+3357
-4
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

65 files changed

+3357
-4
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ target/
2323
*.diff
2424
*.patch
2525
*.tmp
26+
*.java~
27+
*.properties~
28+
*.xml~
2629

2730
# system ignore
2831
.DS_Store

dubbo-remoting/dubbo-remoting-http/pom.xml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,10 @@
4747
<dependency>
4848
<groupId>org.apache.tomcat.embed</groupId>
4949
<artifactId>tomcat-embed-core</artifactId>
50-
<version>8.0.11</version>
5150
</dependency>
5251
<dependency>
5352
<groupId>org.apache.tomcat.embed</groupId>
5453
<artifactId>tomcat-embed-logging-juli</artifactId>
55-
<version>8.0.11</version>
5654
</dependency>
5755
</dependencies>
5856
</project>
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 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+
5+
<groupId>com.alibaba</groupId>
6+
<artifactId>dubbo-demo-lite-archetype</artifactId>
7+
<version>2.8.3</version>
8+
<packaging>maven-archetype</packaging>
9+
10+
<name>dubbo-demo-lite-archetype</name>
11+
12+
<build>
13+
<extensions>
14+
<extension>
15+
<groupId>org.apache.maven.archetype</groupId>
16+
<artifactId>archetype-packaging</artifactId>
17+
<version>2.2</version>
18+
</extension>
19+
</extensions>
20+
21+
<pluginManagement>
22+
<plugins>
23+
<plugin>
24+
<artifactId>maven-archetype-plugin</artifactId>
25+
<version>2.2</version>
26+
</plugin>
27+
</plugins>
28+
</pluginManagement>
29+
</build>
30+
31+
<description>The demo lite module of dubbo project</description>
32+
33+
<url>http://code.alibabatech.com/wiki/display/dubbo/dubbo-demo-lite</url>
34+
35+
<developers>
36+
<developer>
37+
<id>shawn.qianx</id>
38+
<name>QianXiao(Shawn)</name>
39+
<email>shawn.qianx (AT) alibaba-inc.com</email>
40+
<roles>
41+
<role>Developer</role>
42+
</roles>
43+
<timezone>+8</timezone>
44+
</developer>
45+
<developer>
46+
<id>william.liangf</id>
47+
<name>LiangFei(William)</name>
48+
<email>william.liangf (AT) alibaba-inc.com</email>
49+
<roles>
50+
<role>Developer</role>
51+
</roles>
52+
<timezone>+8</timezone>
53+
</developer>
54+
<developer>
55+
<id>ding.lid</id>
56+
<name>LiDing(Jerry)</name>
57+
<email>ding.lid (AT) alibaba-inc.com</email>
58+
<roles>
59+
<role>Developer</role>
60+
</roles>
61+
<timezone>+8</timezone>
62+
</developer>
63+
<developer>
64+
<id>chao.liuc</id>
65+
<name>LiuChao(Charles)</name>
66+
<email>chao.liuc (AT) alibaba-inc.com</email>
67+
<roles>
68+
<role>Developer</role>
69+
</roles>
70+
<timezone>+8</timezone>
71+
</developer>
72+
<developer>
73+
<id>haoming.liuhm</id>
74+
<name>LiuHaoMin(Ludvik)</name>
75+
<email>haoming.liuhm (AT) alibaba-inc.com</email>
76+
<roles>
77+
<role>Developer</role>
78+
</roles>
79+
<timezone>+8</timezone>
80+
</developer>
81+
<developer>
82+
<id>tony.chenl</id>
83+
<name>ChenLei(Tony)</name>
84+
<email>tony.chenl (AT) alibaba-inc.com</email>
85+
<roles>
86+
<role>Developer</role>
87+
</roles>
88+
<timezone>+8</timezone>
89+
</developer>
90+
<developer>
91+
<id>gang.lvg</id>
92+
<name>LvGang(Kimi)</name>
93+
<email>gang.lvg (AT) alibaba-inc.com</email>
94+
<roles>
95+
<role>Developer</role>
96+
</roles>
97+
<timezone>+8</timezone>
98+
</developer>
99+
</developers>
100+
101+
<licenses>
102+
<license>
103+
<name>Apache 2</name>
104+
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
105+
<distribution>repo</distribution>
106+
<comments>A business-friendly OSS license</comments>
107+
</license>
108+
</licenses>
109+
110+
<scm>
111+
<connection>scm:svn:http://code.alibabatech.com/svn/dubbo/trunk/dubbo-demo-lite</connection>
112+
<url>http://code.alibabatech.com/svn/dubbo/trunk/dubbo-demo-lite</url>
113+
</scm>
114+
</project>
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
目的:
2+
快速的使用 maven archetype 进行 dubbox rest 项目工程搭建。
3+
本处默认从 dubbo-demo-lite 构建一个 rest 版本的 dubbox 框架结构。
4+
5+
命令参考:
6+
7+
1. 从一个已有的项目中构建一个 maven archetype,
8+
$ mvn archetype:create-from-project -Darchetype.filteredExtentions=java,xml,jsp,properties,sql
9+
10+
2. 然后再修改模板中的文件,并执行
11+
$ mvn clean install
12+
13+
3. 开始从一个已有的 maven archetype 中复制项目
14+
$ mkdir tmp
15+
$ cd tmp
16+
$ mvn archetype:generate -DarchetypeCatalog=local
17+
18+
更多资料请参考
19+
http://maven.apache.org/archetype/maven-archetype-plugin/examples/create-multi-module-project.html
20+
21+
22+
使用示例列举:
23+
24+
<pre>
25+
kangfoo@kangfoo-dk:~/work/hawkeye/tmp$ mvn archetype:generate -DarchetypeCatalog=local
26+
[INFO] Scanning for projects...
27+
[INFO]
28+
[INFO] ------------------------------------------------------------------------
29+
[INFO] Building Maven Stub Project (No POM) 1
30+
[INFO] ------------------------------------------------------------------------
31+
[INFO]
32+
[INFO] >>> maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom >>>
33+
[INFO]
34+
[INFO] <<< maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom <<<
35+
[INFO]
36+
[INFO] --- maven-archetype-plugin:2.2:generate (default-cli) @ standalone-pom ---
37+
[INFO] Generating project in Interactive mode
38+
[INFO] No archetype defined. Using maven-archetype-quickstart (org.apache.maven.archetypes:maven-archetype-quickstart:1.0)
39+
Choose archetype:
40+
1: local -> com.alibaba:dubbo-demo-lite-archetype (The demo lite module of dubbo project)
41+
Choose a number or apply filter (format: [groupId:]artifactId, case sensitive contains): : 1
42+
Define value for property 'groupId': : com.tima
43+
Define value for property 'artifactId': : test3
44+
Define value for property 'version': 1.0-SNAPSHOT: :
45+
Define value for property 'package': com.tima: : com.tima.test3
46+
Confirm properties configuration:
47+
groupId: com.tima
48+
artifactId: test3
49+
version: 1.0-SNAPSHOT
50+
package: com.tima.test3
51+
Y: : Y
52+
[INFO] ----------------------------------------------------------------------------
53+
[INFO] Using following parameters for creating project from Archetype: dubbo-demo-lite-archetype:2.8.3
54+
[INFO] ----------------------------------------------------------------------------
55+
[INFO] Parameter: groupId, Value: com.tima
56+
[INFO] Parameter: artifactId, Value: test3
57+
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
58+
[INFO] Parameter: package, Value: com.tima.test3
59+
[INFO] Parameter: packageInPathFormat, Value: com/tima/test3
60+
[INFO] Parameter: package, Value: com.tima.test3
61+
[INFO] Parameter: version, Value: 1.0-SNAPSHOT
62+
[INFO] Parameter: groupId, Value: com.tima
63+
[INFO] Parameter: artifactId, Value: test3
64+
[INFO] Parent element not overwritten in /home/kangfoo/work/hawkeye/tmp/test3/test3-api/pom.xml
65+
[INFO] Parent element not overwritten in /home/kangfoo/work/hawkeye/tmp/test3/test3-provider/pom.xml
66+
[INFO] Parent element not overwritten in /home/kangfoo/work/hawkeye/tmp/test3/test3-consumer/pom.xml
67+
[INFO] project created from Archetype in dir: /home/kangfoo/work/hawkeye/tmp/test3
68+
[INFO] ------------------------------------------------------------------------
69+
[INFO] BUILD SUCCESS
70+
[INFO] ------------------------------------------------------------------------
71+
[INFO] Total time: 27.023s
72+
[INFO] Finished at: Fri Dec 12 14:49:00 CST 2014
73+
[INFO] Final Memory: 12M/105M
74+
[INFO] ------------------------------------------------------------------------
75+
kangfoo@kangfoo-dk:~/work/hawkeye/tmp$ cd test3/
76+
kangfoo@kangfoo-dk:~/work/hawkeye/tmp/test3$ ll
77+
总用量 24
78+
drwxrwxr-x 5 kangfoo kangfoo 4096 12月 12 14:49 ./
79+
drwxrwxr-x 4 kangfoo kangfoo 4096 12月 12 14:49 ../
80+
-rw-rw-r-- 1 kangfoo kangfoo 1793 12月 12 14:49 pom.xml
81+
drwxrwxr-x 3 kangfoo kangfoo 4096 12月 12 14:49 test3-api/
82+
drwxrwxr-x 3 kangfoo kangfoo 4096 12月 12 14:49 test3-consumer/
83+
drwxrwxr-x 3 kangfoo kangfoo 4096 12月 12 14:49 test3-provider/
84+
<pre>
85+
86+
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="dubbo-demo-lite"
3+
xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
4+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
5+
<modules>
6+
<module id="${rootArtifactId}-api" dir="__rootArtifactId__-api" name="${rootArtifactId}-api">
7+
<fileSets>
8+
<fileSet filtered="true" packaged="true" encoding="UTF-8">
9+
<directory>src/main/java</directory>
10+
<includes>
11+
<include>**/*.java</include>
12+
</includes>
13+
</fileSet>
14+
</fileSets>
15+
</module>
16+
<module id="${rootArtifactId}-provider" dir="__rootArtifactId__-provider" name="${rootArtifactId}-provider">
17+
<fileSets>
18+
<fileSet filtered="true" packaged="true" encoding="UTF-8">
19+
<directory>src/main/java</directory>
20+
<includes>
21+
<include>**/*.java</include>
22+
</includes>
23+
</fileSet>
24+
<fileSet filtered="true" encoding="UTF-8">
25+
<directory>src/main/webapp</directory>
26+
<includes>
27+
<include>**/*.xml</include>
28+
</includes>
29+
</fileSet>
30+
<fileSet filtered="true" encoding="UTF-8">
31+
<directory>src/main/resources</directory>
32+
<includes>
33+
<include>**/*.xml</include>
34+
</includes>
35+
</fileSet>
36+
<fileSet filtered="true" packaged="true" encoding="UTF-8">
37+
<directory>src/test/java</directory>
38+
<includes>
39+
<include>**/*.java</include>
40+
</includes>
41+
</fileSet>
42+
</fileSets>
43+
</module>
44+
<module id="${rootArtifactId}-consumer" dir="__rootArtifactId__-consumer" name="${rootArtifactId}-consumer">
45+
<fileSets>
46+
<fileSet filtered="true" packaged="true" encoding="UTF-8">
47+
<directory>src/main/java</directory>
48+
<includes>
49+
<include>**/*.java</include>
50+
</includes>
51+
</fileSet>
52+
<fileSet filtered="true" encoding="UTF-8">
53+
<directory>src/main/assembly</directory>
54+
<includes>
55+
<include>**/*.xml</include>
56+
<include>**/*.properties</include>
57+
</includes>
58+
</fileSet>
59+
<fileSet filtered="true" encoding="UTF-8">
60+
<directory>src/main/resources</directory>
61+
<includes>
62+
<include>**/*.xml</include>
63+
</includes>
64+
</fileSet>
65+
<fileSet filtered="true" packaged="true" encoding="UTF-8">
66+
<directory>src/test/java</directory>
67+
<includes>
68+
<include>**/*.java</include>
69+
</includes>
70+
</fileSet>
71+
<fileSet filtered="true" encoding="UTF-8">
72+
<directory>src/test/resources</directory>
73+
<includes>
74+
<include>**/*.xml</include>
75+
</includes>
76+
</fileSet>
77+
</fileSets>
78+
</module>
79+
</modules>
80+
</archetype-descriptor>
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
- Copyright 1999-2011 Alibaba Group.
4+
-
5+
- Licensed under the Apache License, Version 2.0 (the "License");
6+
- you may not use this file except in compliance with the License.
7+
- You may obtain a copy of the License at
8+
-
9+
- http://www.apache.org/licenses/LICENSE-2.0
10+
-
11+
- Unless required by applicable law or agreed to in writing, software
12+
- distributed under the License is distributed on an "AS IS" BASIS,
13+
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
- See the License for the specific language governing permissions and
15+
- limitations under the License.
16+
--><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
17+
<modelVersion>4.0.0</modelVersion>
18+
<parent>
19+
<groupId>${groupId}</groupId>
20+
<artifactId>${rootArtifactId}</artifactId>
21+
<version>${version}</version>
22+
</parent>
23+
<artifactId>${artifactId}</artifactId>
24+
<packaging>jar</packaging>
25+
<name>${project.artifactId}</name>
26+
<description>The demo module of dubbo project</description>
27+
<properties>
28+
<skip_maven_deploy>true</skip_maven_deploy>
29+
</properties>
30+
<dependencies>
31+
<dependency>
32+
<groupId>com.alibaba</groupId>
33+
<artifactId>dubbo</artifactId>
34+
</dependency>
35+
<dependency>
36+
<groupId>javax.servlet</groupId>
37+
<artifactId>javax.servlet-api</artifactId>
38+
</dependency>
39+
<dependency>
40+
<groupId>javax.validation</groupId>
41+
<artifactId>validation-api</artifactId>
42+
</dependency>
43+
</dependencies>
44+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#set( $symbol_pound = '#' )
2+
#set( $symbol_dollar = '$' )
3+
#set( $symbol_escape = '\' )
4+
/**
5+
* Copyright 1999-2014 dangdang.com.
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
package ${package};
20+
21+
import com.alibaba.dubbo.common.serialize.support.SerializationOptimizer;
22+
import ${package}.user.User;
23+
24+
import java.util.Collection;
25+
import java.util.LinkedList;
26+
import java.util.List;
27+
28+
/**
29+
* This class must be accessible from both the provider and consumer
30+
*
31+
* @author lishen
32+
*/
33+
public class SerializationOptimizerImpl implements SerializationOptimizer {
34+
35+
public Collection<Class> getSerializableClasses() {
36+
List<Class> classes = new LinkedList<Class>();
37+
classes.add(User.class);
38+
return classes;
39+
}
40+
}

0 commit comments

Comments
 (0)