update md
This commit is contained in:
parent
48533e05fd
commit
020779b745
24
README.md
24
README.md
@ -4,6 +4,10 @@ weixin4j
|
||||
微信开发工具包
|
||||
-------------
|
||||
|
||||
项目说明
|
||||
-------
|
||||
`weixin4j`是一个用java编写针对微信开发的工具包,包含`weixin4j-mp`(微信公众平台)、`weixin4j-qy`(微信企业号)和`weixin4j-netty`(微信被动消息服务器)三个工程
|
||||
|
||||
功能列表
|
||||
-------
|
||||
* **weixin4j-mp**
|
||||
@ -20,14 +24,6 @@ weixin4j
|
||||
|
||||
`netty服务器&消息分发`
|
||||
|
||||
项目说明
|
||||
-------
|
||||
+ `weixin4j`包含「微信公众平台」和「微信企业号」的API封装.
|
||||
|
||||
+ API的成功调用依赖于正确的appid等数据,填写格式说明见API工程下的README.md文件.
|
||||
|
||||
+ netty服务正在重构中
|
||||
|
||||
如何获取
|
||||
----------
|
||||
###1.maven依赖(1.4,2015-04-29 released)
|
||||
@ -45,9 +41,13 @@ weixin4j
|
||||
<artifactId>weixin4j-qy</artifactId>
|
||||
<version>1.4</version>
|
||||
</dependency>
|
||||
微信被动消息服务器
|
||||
微信被动消息服务器(本周内部署到中央库)
|
||||
|
||||
`正在重构中..`
|
||||
<dependency>
|
||||
<groupId>com.foxinmy</groupId>
|
||||
<artifactId>weixin4j-server</artifactId>
|
||||
<version>0.0.1</version>
|
||||
</dependency>
|
||||
|
||||
以上依赖如果出现Missing artifact错误 请尝试在eclipse里这么做
|
||||
|
||||
@ -69,10 +69,6 @@ https://github.com/foxinmy/weixin4j/releases
|
||||
|
||||
接下来
|
||||
------
|
||||
* 被动消息服务重构
|
||||
|
||||

|
||||
|
||||
* 公众号第三方服务应用
|
||||
|
||||
* 企业号第三方应用 & 企业号登陆授权
|
||||
|
||||
55
pom.xml
55
pom.xml
@ -43,15 +43,11 @@
|
||||
<module>weixin4j-base</module>
|
||||
<module>weixin4j-mp</module>
|
||||
<module>weixin4j-qy</module>
|
||||
<module>weixin4j-server</module>
|
||||
</modules>
|
||||
<properties>
|
||||
<jdk.version>1.7</jdk.version>
|
||||
<junit.version>4.8.2</junit.version>
|
||||
<dom4j.version>1.6.1</dom4j.version>
|
||||
<logback.version>1.0.9</logback.version>
|
||||
<jcl.over.version>1.7.6</jcl.over.version>
|
||||
<log4j.over.version>1.7.6</log4j.over.version>
|
||||
<jcl.version>1.7.6</jcl.version>
|
||||
<xstream.version>1.4.7</xstream.version>
|
||||
<httpclient.version>4.2.5</httpclient.version>
|
||||
<commons.codec.version>1.9</commons.codec.version>
|
||||
@ -60,35 +56,25 @@
|
||||
<jaxen.version>1.1.6</jaxen.version>
|
||||
<jedis.version>2.6.0</jedis.version>
|
||||
<poi.version>3.9</poi.version>
|
||||
<netty.version>4.0.23.Final</netty.version>
|
||||
<commons.lang.version>3.3.2</commons.lang.version>
|
||||
<commons.codec.version>1.9</commons.codec.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.source.plugin.version>2.4</maven.source.plugin.version>
|
||||
<maven.compiler.plugin.version>3.0</maven.compiler.plugin.version>
|
||||
<maven.resources.plugin.version>2.6</maven.resources.plugin.version>
|
||||
<maven.jar.plugin.version>2.5</maven.jar.plugin.version>
|
||||
<maven.assembly.plugin.version>2.5.1</maven.assembly.plugin.version>
|
||||
<maven.javadoc.plugin.version>2.10.1</maven.javadoc.plugin.version>
|
||||
<maven.deploy.plugin.version>2.8.2</maven.deploy.plugin.version>
|
||||
<maven.gpg.plugin.version>1.5</maven.gpg.plugin.version>
|
||||
<maven.surefire.plugin.version>2.18</maven.surefire.plugin.version>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>${maven.compiler.plugin.version}</version>
|
||||
<version>3.0</version>
|
||||
<configuration>
|
||||
<source>${jdk.version}</source>
|
||||
<target>${jdk.version}</target>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>${maven.resources.plugin.version}</version>
|
||||
<version>2.6</version>
|
||||
<configuration>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
<!-- 过滤证书文件 -->
|
||||
@ -103,7 +89,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>${maven.jar.plugin.version}</version>
|
||||
<version>2.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-jar</id>
|
||||
@ -129,29 +115,10 @@
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>${maven.assembly.plugin.version}</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>${maven.source.plugin.version}</version>
|
||||
<version>2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
@ -164,7 +131,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>${maven.javadoc.plugin.version}</version>
|
||||
<version>2.10.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
@ -186,12 +153,12 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>${maven.deploy.plugin.version}</version>
|
||||
<version>2.8.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>${maven.gpg.plugin.version}</version>
|
||||
<version>1.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
@ -204,7 +171,7 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>${maven.surefire.plugin.version}</version>
|
||||
<version>2.18</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
|
||||
@ -41,7 +41,7 @@ weixin4j-mp
|
||||
|
||||
如何使用
|
||||
--------
|
||||
1.API工程可以单独打包到其他项目中使用,需新增或拷贝`weixin.properties`文件到项目的`classpath`中
|
||||
1.需新增或拷贝`weixin.properties`文件到项目的`classpath`中
|
||||
|
||||
weixin.properties说明
|
||||
|
||||
@ -74,7 +74,7 @@ weixin.properties说明
|
||||
ca_file=/tmp/weixin/xxxxx.p12
|
||||
#classpath路径下:ca_file=classpath:xxxxx.p12
|
||||
|
||||
#微信登陆授权的重定向路径
|
||||
#微信登陆授权的重定向路径(使用OauthApi时需要填写)
|
||||
redirect_uri=http://xxx
|
||||
|
||||
2.实例化一个`WeixinProxy`对象,调用API,需要强调的是如果只传入appid,appsecret两个参数将无法调用支付相关接口
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${jcl.over.version}</version>
|
||||
<version>${jcl.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>jaxen</groupId>
|
||||
|
||||
@ -25,7 +25,7 @@ weixin4j-qy
|
||||
|
||||
如何使用
|
||||
--------
|
||||
1.API工程可以单独打包到其他项目中使用,需新增或拷贝`weixin.properties`文件到项目的`classpath`中
|
||||
1.需新增或拷贝`weixin.properties`文件到项目的`classpath`中
|
||||
|
||||
weixin.properties说明
|
||||
|
||||
|
||||
@ -7,61 +7,123 @@ weixin4j-server
|
||||
功能列表
|
||||
-------
|
||||
|
||||
* `netty构建服务器`
|
||||
* `netty服务器`
|
||||
|
||||
* `消息分发`
|
||||
|
||||
* `消息拦截`
|
||||
|
||||
如何使用
|
||||
--------
|
||||
1.正确填写`weixin.properties`中的属性值
|
||||
-------
|
||||
编写一个简单的服务启动类
|
||||
|
||||
| 属性名 | 说明 |
|
||||
| :---------- | :-------------- |
|
||||
| account | 微信公众号信息 `json格式` |
|
||||
| token_path | 使用FileTokenHolder时token保存的物理路径 |
|
||||
| qr_path | 调用二维码接口时保存二维码图片的物理路径 |
|
||||
| media_path | 调用媒体接口时保存媒体文件的物理路径 |
|
||||
| bill_path | 调用下载对账单接口保存excel文件的物理路径 |
|
||||
| ca_file | 调用某些接口(支付相关)强制需要auth的ca授权文件 |
|
||||
public class MessageServerStartup{
|
||||
public static void main(String[] args) {
|
||||
new WeixinServerBootstrap("开发者token").pushMessageHandler(
|
||||
DebugMessageHandler.global).startup();
|
||||
}
|
||||
}
|
||||
以上代码就会启动一个适用于`明文模式`并总是调试输出微信请求信息的消息服务.
|
||||
|
||||
示例(properties中换行用右斜杆\\)
|
||||
密文模式的服务启动类
|
||||
|
||||
account={"id":"appId","secret":"appSecret",\\
|
||||
"token":"开放者的token","openId":"公众号的openid 非必须",\\
|
||||
"encodingAesKey":"公众号设置了加密方式且为「安全模式」时需要填入",\\
|
||||
"mchId":"V3.x版本下的微信商户号",\\
|
||||
"partnerId":"V2版本下的财付通的商户号","partnerKey":"V2版本下的财付通商户权限密钥Key",\\
|
||||
"version":"针对微信支付的版本号(目前可能为2,3),如果不填则按照mchId非空与否来做判断",\\
|
||||
"paySignKey":"微信支付中调用API的密钥"}
|
||||
|
||||
token_path=/tmp/weixin/token
|
||||
qr_path=/tmp/weixin/qr
|
||||
media_path=/tmp/weixin/media
|
||||
bill_path=/tmp/weixin/bill
|
||||
ca_file=/tmp/weixin/xxxxx.p12 | xxxxx.pfx
|
||||
|
||||
2.在对应的action中实现自己的具体业务 如 TextAction 则表示收到文本消息
|
||||
|
||||
@Override
|
||||
public ResponseMessage execute(TextMessage inMessage) {
|
||||
return new ResponseMessage(new Text("Hello World!"), inMessage);
|
||||
public class MessageServerStartup{
|
||||
public static void main(String[] args) {
|
||||
new WeixinServerBootstrap("appid","开发者token","加密密钥").pushMessageHandler(
|
||||
DebugMessageHandler.global).startup();
|
||||
}
|
||||
}
|
||||
|
||||
3.`mvn package`,得到一个zip的压缩包,解压(也可使用deploy.xml部署到远程服务器)到`启动目录`
|
||||
只回复文本消息的服务启动类
|
||||
|
||||
4.启动netty服务(`com.foxinmy.weixin4j.mp.startup.WeixinMpServerBootstrap`)
|
||||
public class MessageServerStartup{
|
||||
public static void main(String[] args) {
|
||||
// 需要一个文本消息的handler
|
||||
WeixinMessageHandler messageHandler = new WeixinMessageHandler() {
|
||||
@Override
|
||||
public WeixinResponse doHandle(WeixinRequest request,
|
||||
WeixinMessage message) throws WeixinException {
|
||||
return new TextResponse("HelloWorld!");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHandle(WeixinRequest request,
|
||||
WeixinMessage message) {
|
||||
return message.getMsgType().equals("text");
|
||||
}
|
||||
};
|
||||
// 当消息类型为文本(text)时回复「HelloWorld」, 否则回复调试消息
|
||||
new WeixinServerBootstrap("appid","开发者token","加密密钥").pushMessageHandler(messageHandler,
|
||||
DebugMessageHandler.global).startup();
|
||||
}
|
||||
}
|
||||
|
||||
更多内容将会写在wiki里
|
||||
|
||||
assembly打包(辅助)
|
||||
-----------------
|
||||
[assembly](http://maven.apache.org/plugins/maven-assembly-plugin/assembly.html)是maven的一个打包插件,它可以创建一个包含脚本、配置文件以及所有运行时所依赖的元素(jar)Assembly插件能帮你构建一个完整的发布包.
|
||||
|
||||
1.复制[assembly描述](./src/main/assembly.xml)和[启动脚本](./src/main/startup.sh)到自己工程的src/main目录下.
|
||||
|
||||
2.在项目pom.xml中的/bulid/plugins节点新增如下配置
|
||||
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
<finalName>weixin-server</finalName>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
`descriptor`表示[assembly](./src/main/assembly.xml)文件的位置.
|
||||
|
||||
`finalName`表示打包(zip)后的文件名,需配合启动脚本中`APP_HOME`的值使用.
|
||||
|
||||
3.[启动脚本](./src/main/startup.sh)中`JAVA_HOME`为java运行环境(jre|jdk)的安装根目录,如果与脚本中的值不一致,可使用`ln -s t/usr/local/java 实际的目录`.
|
||||
|
||||
4.[启动脚本](./src/main/startup.sh)中`APP_HOME`的值为服务的启动目录,相当于运行服务时的classpath目录.
|
||||
|
||||
5.修改[启动脚本](./src/main/startup.sh)中`APP_MAINCLASS`的值为上述编写的netty服务启动类.
|
||||
|
||||
6.执行`mvn package`命令后在target目录下得到一个zip的压缩包,在7或者8中选择一种方式启动服务.
|
||||
|
||||
7.[上传zip包到服务器],解压包到启动目录(`APP_HOME`)的`上一级目录`后运行startup.sh脚本.
|
||||
|
||||
sh startup.sh start
|
||||
|
||||
> 1.服务的启动脚本[startup.sh](./src/main/startup.sh)需要被注意到,有`JAVA_HOME`和`APP_HOME`两个参数.
|
||||
8.ant远程部署
|
||||
|
||||
> 2.其中`JAVA_HOME`参数值指的是java运行环境(jre|jdk)的安装根目录,如果与脚本中的值不一致,可以改更为实际的路径或者使用`ln -s t/usr/local/java target`软链接命令创建期望的链接.
|
||||
> 复制[`deploy.xml`](./deploy.xml)到自己工程的根目录下.
|
||||
|
||||
> 3.其中`APP_HOME`参数值指的是本服务的启动目录,此目录需要被正确事先创建好,同时[`deploy.xml`](./deploy.xml)远程部署命令也依赖于此.
|
||||
> Ant远程部署[`deploy.xml`](./deploy.xml)的正确执行需要[`jsch`](http://www.jcraft.com/jsch/)包的支持,下载jar包将其引入执行Ant命令时的`classpath`中.
|
||||
|
||||
> 4.Ant远程部署[`deploy.xml`](./deploy.xml)的正确执行需要[`jsch`](http://www.jcraft.com/jsch/)包的支持,下载jar包将其引入执行Ant命令时的`classpath`中.
|
||||
> 正确填写`zip.name`、`host`、`pwd`、`main.dir`、`sub.dir`五个属性值.
|
||||
|
||||
> 5.一般来说*Action事件处理类中应该有自己的实际业务类(`service`)需要被注入,可以使用org.springframework.context.ApplicationContext#getBeansWithAnnotation(ActionAnnotation.class)函数获取Action集合后再来实现[`AbstractActionMapping`](https://github.com/foxinmy/weixin4j/blob/master/weixin4j-base/src/main/java/com/foxinmy/weixin4j/action/mapping/AbstractActionMapping.java).
|
||||
> 右键 Run as -> Ant Build
|
||||
|
||||
[更新LOG](./CHANGE.md)
|
||||
----------------------
|
||||
|
||||
相关参考
|
||||
-------
|
||||
|
||||

|
||||
|
||||
[spring-webmvc:DispatcherServlet](https://github.com/spring-projects/spring-framework/blob/master/spring-webmvc/src/main/java/org/springframework/web/servlet/DispatcherServlet.java)
|
||||
|
||||
[spring-webmvc:HandlerAdapter](https://github.com/spring-projects/spring-framework/blob/master/spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerAdapter.java)
|
||||
|
||||
[spring-webmvc:HandlerInterceptor](https://github.com/spring-projects/spring-framework/blob/master/spring-webmvc/src/main/java/org/springframework/web/servlet/HandlerInterceptor.java)
|
||||
@ -1,12 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project name="mp-server" default="deploy" basedir=".">
|
||||
<project name="weixin-server" default="deploy" basedir=".">
|
||||
<property name="app.home" value="." />
|
||||
<property name="target.home" value="${app.home}/target" />
|
||||
<property name="zip.name" value="weixin-mp-server-bin.zip" />
|
||||
<property name="zip.name" value="assembly打包后的文件名,如weixin-server-bin.zip" />
|
||||
<property name="host" value="服务器IP" />
|
||||
<property name="pwd" value="服务器口令" />
|
||||
<property name="main.dir" value="服务部署的主目录,如/usr/local/weixin" />
|
||||
<property name="sub.dir" value="服务部署的子目录,如weixin-mp-server" />
|
||||
<property name="sub.dir" value="服务部署的子目录,如weixin-server" />
|
||||
|
||||
<target name="removeZip">
|
||||
<echo>
|
||||
@ -22,28 +22,28 @@
|
||||
<scp file="${target.home}/${zip.name}" todir="root:${pwd}@${host}:${main.dir}" trust="true" />
|
||||
</target>
|
||||
|
||||
<target name="shutdownService" depends="uploadZip">
|
||||
<target name="shutdownServer" depends="uploadZip">
|
||||
<echo>
|
||||
${host}:停止[${sub.dir}]...
|
||||
</echo>
|
||||
<sshexec host="${host}" username="root" password="${pwd}" trust="true" command="cd ${main.dir}/${sub.dir};pwd;sh startup.sh stop;rm -rf ${main.dir}/${sub.dir};" />
|
||||
</target>
|
||||
|
||||
<target name="unzipProject" depends="shutdownService">
|
||||
<target name="unzipProject" depends="shutdownServer">
|
||||
<echo>
|
||||
${host}:解压${zip.name}...
|
||||
</echo>
|
||||
<sshexec host="${host}" username="root" password="${pwd}" trust="true" command="cd ${main.dir};pwd;unzip ${zip.name};" />
|
||||
</target>
|
||||
|
||||
<target name="startupService" depends="unzipProject">
|
||||
<target name="startupServer" depends="unzipProject">
|
||||
<echo>
|
||||
${host}:启动服务...
|
||||
</echo>
|
||||
<sshexec host="${host}" username="root" password="${pwd}" trust="true" command="cd ${main.dir}/${sub.dir};pwd;sh startup.sh start;" />
|
||||
</target>
|
||||
|
||||
<target name="build" depends="startupService">
|
||||
<target name="build" depends="startupServer">
|
||||
<echo>
|
||||
target.home = ${target.home}
|
||||
file.zip = ${target.home}/${zip.name}
|
||||
|
||||
@ -2,58 +2,210 @@
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.foxinmy</groupId>
|
||||
<artifactId>weixin4j</artifactId>
|
||||
<version>1.4</version>
|
||||
</parent>
|
||||
<groupId>com.foxinmy</groupId>
|
||||
<artifactId>weixin4j-server</artifactId>
|
||||
<version>0.0.1</version>
|
||||
<name>weixin4j-server</name>
|
||||
<url>https://github.com/foxinmy/weixin4j/tree/master/weixin4j-server</url>
|
||||
<description>微信netty服务</description>
|
||||
<inceptionYear>2014</inceptionYear>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>Apache License, Version 2.0</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
<comments>A business-friendly OSS license</comments>
|
||||
</license>
|
||||
</licenses>
|
||||
<scm>
|
||||
<url>https://github.com/foxinmy/weixin4j</url>
|
||||
<connection>scm:git:git://github.com/foxinmy/weixin4j.git</connection>
|
||||
<developerConnection>scm:git:git@github.com:foxinmy/weixin4j.git</developerConnection>
|
||||
<tag>HEAD</tag>
|
||||
</scm>
|
||||
<issueManagement>
|
||||
<url>https://github.com/foxinmy/weixin4j/issues</url>
|
||||
</issueManagement>
|
||||
<developers>
|
||||
<developer>
|
||||
<email>hujinyuhao@163.com</email>
|
||||
<id>jinyu</id>
|
||||
<name>jinyu</name>
|
||||
<url>https://github.com/foxinmy</url>
|
||||
<timezone>+8</timezone>
|
||||
<roles>
|
||||
<role>java developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
</developers>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.0</version>
|
||||
<configuration>
|
||||
<finalName>weixin-server</finalName>
|
||||
<source>1.7</source>
|
||||
<target>1.7</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<configuration>
|
||||
<skip>true</skip>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
<!-- 过滤证书文件 -->
|
||||
<nonFilteredFileExtensions>
|
||||
<nonFilteredFileExtension>pem</nonFilteredFileExtension>
|
||||
<nonFilteredFileExtension>pfx</nonFilteredFileExtension>
|
||||
<nonFilteredFileExtension>p12</nonFilteredFileExtension>
|
||||
<nonFilteredFileExtension>jks</nonFilteredFileExtension>
|
||||
</nonFilteredFileExtensions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>default-jar</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<classesDirectory>target/classes</classesDirectory>
|
||||
<excludes>
|
||||
<exclude>*.properties</exclude>
|
||||
<exclude>*.xml</exclude>
|
||||
<exclude>*.txt</exclude>
|
||||
<exclude>**/*.md</exclude>
|
||||
</excludes>
|
||||
<archive>
|
||||
<addMavenDescriptor>false</addMavenDescriptor>
|
||||
</archive>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
<version>2.4</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-sources</id>
|
||||
<goals>
|
||||
<goal>jar-no-fork</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
<version>2.10.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>attach-javadocs</id>
|
||||
<goals>
|
||||
<goal>jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<show>public</show>
|
||||
<charset>${project.build.sourceEncoding}</charset>
|
||||
<encoding>${project.build.sourceEncoding}</encoding>
|
||||
<docencoding>${project.build.sourceEncoding}</docencoding>
|
||||
<links>
|
||||
<link>http://docs.oracle.com/javase/7/docs/api</link>
|
||||
</links>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.8.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
<version>1.5</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>verify</phase>
|
||||
<goals>
|
||||
<goal>sign</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.18</version>
|
||||
<configuration>
|
||||
<skipTests>true</skipTests>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/java</directory>
|
||||
<includes>
|
||||
<include>**/*.xml</include>
|
||||
<include>**/*.properties</include>
|
||||
<include>**/*.pem</include>
|
||||
<include>**/*.p12</include>
|
||||
<include>**/*.pfx</include>
|
||||
</includes>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>*.xml</include>
|
||||
<include>*.properties</include>
|
||||
</includes>
|
||||
</resource>
|
||||
</resources>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>io.netty</groupId>
|
||||
<artifactId>netty-all</artifactId>
|
||||
<version>${netty.version}</version>
|
||||
<version>4.0.23.Final</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.slf4j</groupId>
|
||||
<artifactId>slf4j-api</artifactId>
|
||||
<version>${jcl.over.version}</version>
|
||||
<version>1.7.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.8.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpcore</artifactId>
|
||||
<version>${httpclient.version}</version>
|
||||
<version>4.2.5</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>${httpclient.version}</version>
|
||||
<version>4.2.5</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>commons-codec</groupId>
|
||||
@ -67,4 +219,35 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>release</id>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-source-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-javadoc-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-gpg-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</profile>
|
||||
</profiles>
|
||||
<distributionManagement>
|
||||
<snapshotRepository>
|
||||
<id>oss-snapshot</id>
|
||||
<url>https://oss.sonatype.org/content/repositories/snapshots/</url>
|
||||
</snapshotRepository>
|
||||
<repository>
|
||||
<id>oss-release</id>
|
||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
|
||||
</repository>
|
||||
</distributionManagement>
|
||||
</project>
|
||||
@ -6,7 +6,7 @@ import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
/**
|
||||
* 被动消息
|
||||
* 被动消息(待完善)
|
||||
*
|
||||
* @className WeixinMessage
|
||||
* @author jy
|
||||
|
||||
@ -9,7 +9,7 @@ RUNNING_USER=root
|
||||
APP_HOME="/usr/local/weixin/weixin-server"
|
||||
|
||||
#main class
|
||||
APP_MAINCLASS=com.foxinmy.weixin4j.startup.WeixinServerBootstrap
|
||||
APP_MAINCLASS=netty服务启动类
|
||||
|
||||
#classpath
|
||||
CLASSPATH=$APP_HOME/classes
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user