Android开发积累 2013-10-23
1、注册app
获取appid和name
如:
appid:
10279
appname:
secondhand-test
2、配置app.yaml文件
与pom.xml同级
app.yaml
appid: 10279 install: [jetty] start: $JETTY_START webHealth: true setenv: {JVM_ARGS: '-Dspring.profiles.active=product -XX:MaxPermSize=128m -XX:PermSize=128m'}
3、在src/main目录下
添加assemble/package.xml文件
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> <id>wap_building</id> <formats> <format>zip</format> </formats> <includeBaseDirectory>false</includeBaseDirectory> <fileSets> <fileSet> <includes> <include>app.yaml</include> </includes> <outputDirectory>/</outputDirectory> </fileSet> <fileSet> <directory>${basedir}/target/app</directory> <includes> <include>**</include> </includes> <outputDirectory>/app/</outputDirectory> </fileSet> </fileSets> </assembly>
4、修改pom.xml文件
<build> <finalName>app</finalName> <plugin> <artifactId>maven-assembly-plugin</artifactId> <version>2.4</version> <configuration> <descriptors> <descriptor>src/main/assemble/package.xml</descriptor> </descriptors> </configuration> <executions> <execution> <id>make-assembly</id> <phase>package</phase> <goals> <goal>single</goal> </goals> </execution> </executions> </plugin> </plugins>
5、log4j.xml
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> <log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/"> <appender name="console" class="org.apache.log4j.ConsoleAppender"> <param value="System.out" name="Target" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n" /> </layout> </appender> <appender name="file" class="org.apache.log4j.DailyRollingFileAppender"> <param name="Append" value="true" /> <param name="File" value="${LOG_FILE}" /> <!-- <param name="File" value="/opt/jetty_dev/logs/app_10220.log" /> --> <param name="DatePattern" value="'.'_yyyy-MM-dd" /> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="[framework] %d - %c -%-4r [%t] %-5p %c %x - %m%n" /> </layout> </appender> <logger name="net.paoding.rose" additivity="false"> <level value="error" /> </logger> <logger name="org.springframework" additivity="false"> <level value="error" /> </logger> <logger name="cn.focus" additivity="false"> <level value="info" /> <appender-ref ref="console" /> <appender-ref ref="file" /> </logger> <logger name="com.sohu" additivity="false"> <level value="error" /> </logger> <logger name="net.paoding.rose.controllers.ToolsController" additivity="false"> <level value="error" /> </logger> <root> <level value="INFO" /> <appender-ref ref="console" /> <appender-ref ref="file" /> </root> </log4j:configuration>
6、在工程目录下
mvn-Upackageassembly:single
mvn-U-Dtest_scepackageassembly:single
mvn-U-Dproductpackageassembly:single
生成app-wap_building.zip
更新jetty-env.xml和app.yam文件
7、然后再平台上传并部署工程
8、创建CRTpublickey
Tools-createpublickey
Key选择RSA
然后下一步
填写qiaowang@qiaowang(这两个是密码,也可不填)
qiaowang@qiaowang
选择OpenSSHKeyformat
生成
C:\Users\qiaowang\Documents\Identity.pub
中添加到账户配置中的SSHKeys中
用crt连接是用户为10279(分配的appid),连接方式选publishkey
echo$LOG_FILE
tail-f/opt/logs/app_10279.log
9、web.xml文件为
<context-param> <param-name>log4jExposeWebAppRoot</param-name> <param-value>false</param-value> </context-param> <context-param> <param-name>spring.profiles.default</param-name> <param-value>local</param-value> </context-param> <context-param> <param-name>log4jConfigLocation</param-name> <param-value>WEB-INF/log4j.xml</param-value> </context-param>
10、添加jetty-env.xml文件
<?xml version="1.0"?> <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd"> <Configure class="org.eclipse.jetty.webapp.WebAppContext"> <New id="focus_dc" class="org.eclipse.jetty.plus.jndi.Resource"> <Arg>java:comp/env/jdbc/focus_dc</Arg> <Arg> <New class="org.apache.commons.dbcp.BasicDataSource"> <Set name="driverClassName">com.mysql.jdbc.Driver</Set> <Set name="url">jdbc:mysql://10.11.4.69:3306/focus_dc?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull</Set> <Set name="username">****</Set> <Set name="password">****</Set> <Set name="maxActive" type="int">100</Set> <Set name="maxIdle" type="int">30</Set> <Set name="maxWait" type="int">1000</Set> <Set name="defaultAutoCommit" type="boolean">true</Set> <Set name="removeAbandoned" type="boolean">true</Set> <Set name="removeAbandonedTimeout" type="int">60</Set> <Set name="logAbandoned" type="boolean">true</Set> <Set name="validationQuery">SELECT 1</Set> </New> </Arg> </New> <New id="focus_dc" class="org.eclipse.jetty.plus.jndi.Resource"> <Arg>java:comp/env/jdbc/focus_dc_read</Arg> <Arg> <New class="org.apache.commons.dbcp.BasicDataSource"> <Set name="driverClassName">com.mysql.jdbc.Driver</Set> <Set name="url">jdbc:mysql://10.11.4.69:3306/focus_dc?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull</Set> <Set name="username">****</Set> <Set name="password">*****</Set> <Set name="maxActive" type="int">100</Set> <Set name="maxIdle" type="int">30</Set> <Set name="maxWait" type="int">1000</Set> <Set name="defaultAutoCommit" type="boolean">true</Set> <Set name="removeAbandoned" type="boolean">true</Set> <Set name="removeAbandonedTimeout" type="int">60</Set> <Set name="logAbandoned" type="boolean">true</Set> <Set name="validationQuery">SELECT 1</Set> </New> </Arg> </New> </Configure>
其他链接数据库方式
<!-- 本机测试环境 和 156测试环境数据源配置 --> <beans profile="local,test,test_sce"> <bean id="jade.dataSource.pinge" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> <property name="driverClassName" value="com.mysql.jdbc.Driver"/> <property name="url" value="jdbc:mysql://10.10.90.156:3306/pinge?useUnicode=true&characterEncoding=utf-8&autoReconnect=true&generateSimpleParameterMetadata=true"/> <property name="username" value="******"/> <property name="password" value="******"/> <property name="maxActive" value="100"/> <property name="maxIdle" value="30"/> <property name="maxWait" value="1000"/> <property name="testOnBorrow" value="true"/> <property name="testWhileIdle" value="true"/> <property name="removeAbandoned" value="true"/> <property name="removeAbandonedTimeout" value="60"/> <property name="validationQuery" value="select 1"/> <property name="poolPreparedStatements" value="true"/> <property name="defaultAutoCommit" value="true"/> </bean> </beans> <!-- SCE正式环境 和 SCE测试环境数据源配置 --> <beans profile="product"> <bean id="jade.dataSource.pinge" class="net.paoding.rose.jade.dataaccess.datasource.MasterSlaveDataSourceFactory"> <constructor-arg index="0"> <ref local="pinge_dc_master"/> </constructor-arg> <constructor-arg index="1"> <list> <ref local="pinge_dc_slave"/> </list> </constructor-arg> <constructor-arg index="2" value="false"/> </bean> <bean id="pinge_dc_master" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="[color=red]java:comp/env/jdbc/focus_pinge[/color]"/> </bean> <bean id="pinge_dc_slave" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiName" value="[color=red]java:comp/env/jdbc/focus_pinge_read[/color]"/> </bean> </beans>