Commit 349e5627 authored by Liang Ding's avatar Liang Ding

#12037

TODO: 读取 host、port 配置
parent f574cef6
<?xml version="1.0" encoding="UTF-8"?>
<!--
Description: Solo POM.
Version: 2.5.1.7, Oct 17, 2015
Version: 2.6.1.7, Oct 25, 2015
Author: Liang Ding
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
......@@ -113,6 +113,7 @@
<jsoup.version>1.5.2</jsoup.version>
<markdownpapers-core.version>1.4.2</markdownpapers-core.version>
<qiniu.version>7.0.4.1</qiniu.version>
<jetty.version>9.2.13.v20150730</jetty.version>
<!-- maven plugin -->
<maven-compiler-plugin.version>3.3</maven-compiler-plugin.version>
......@@ -125,7 +126,7 @@
<testng.version>6.1.1</testng.version>
<gae.version>1.8.1.1</gae.version>
<!-- JDBC Drivers -->
<mysql-connector-java.version>5.1.36</mysql-connector-java.version>
<mysql-connector-java.version>5.1.37</mysql-connector-java.version>
</properties>
<dependencies>
......@@ -134,10 +135,6 @@
<artifactId>latke</artifactId>
<version>${org.b3log.latke.version}</version>
<exclusions>
<exclusion>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</exclusion>
<exclusion>
<groupId>com.jolbox</groupId>
<artifactId>bonecp</artifactId>
......@@ -153,7 +150,6 @@
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>${servlet.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
......@@ -168,6 +164,11 @@
<version>${org.b3log.latke.version}</version>
</dependency>
<dependency>
<groupId>org.b3log</groupId>
<artifactId>latke-repository-h2</artifactId>
<version>${org.b3log.latke.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
......@@ -200,7 +201,13 @@
<version>${qiniu.version}</version>
</dependency>
<!-- BEGIN GAE related dependencies just for test -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${jetty.version}</version>
</dependency>
<!-- BEGIN: GAE related dependencies just for testing -->
<dependency>
<groupId>org.b3log</groupId>
<artifactId>latke-gae</artifactId>
......@@ -221,7 +228,7 @@
<version>${gae.version}</version>
<scope>test</scope>
</dependency>
<!-- END GAE related dependencies just for test -->
<!-- END: GAE related dependencies just for testing -->
</dependencies>
<build>
......
/*
* Copyright (c) 2010-2015, b3log.org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.b3log.solo;
import java.awt.Desktop;
import java.io.File;
import java.net.URI;
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.webapp.WebAppContext;
/**
* Solo with embedded Jetty.
*
* <ul>
* <li>Windows: java -cp WEB-INF/lib/*;WEB-INF/classes org.b3log.solo.Solo</li>
* <li>Unix-like: java -cp WEB-INF/lib/*:WEB-INF/classes org.b3log.solo.Solo</li>
* </ul>
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.0, Oct 25, 2015
* @since 1.2.0
*/
public final class Starter {
/**
* Main.
*
* @param args the specified arguments
* @throws java.lang.Exception if start failed
*/
public static void main(final String[] args) throws Exception {
String webappDirLocation = "src/main/webapp/"; // POM structure in dev env
final File file = new File(webappDirLocation);
if (!file.exists()) {
webappDirLocation = "."; // Release prod env
}
final int port = 8080; // TODO: read from conf
final String contextPath = "/"; // TODO: read from conf
Server server = new Server(port);
WebAppContext root = new WebAppContext();
root.setContextPath(contextPath);
root.setDescriptor(webappDirLocation + "/WEB-INF/web.xml");
root.setResourceBase(webappDirLocation);
server.setHandler(root);
server.start();
try {
Desktop.getDesktop().browse(new URI("http://localhost:" + port));
} catch (final Throwable e) {
e.printStackTrace();
}
server.join();
}
/**
* Private constructor.
*/
private Starter() {
}
}
......@@ -18,23 +18,25 @@
# Description: Solo local environment configurations. Configures this file
# if Solo runs on a standard Servlet container or Baidu App Engine,
# it is unnecessary to care this file if Solo runs on Google App Engine.
# Version: 1.0.2.6, Feb 11, 2015
# Version: 1.1.2.6, Oct 25, 2015
# Author: Liang Ding
#
#### Runtime Database (RuntimeDatabase) ####
runtimeDatabase=MYSQL
#### MySQL runtime ####
#runtimeDatabase=MYSQL
#jdbc.username=root
#jdbc.password=
#jdbc.driver=com.mysql.jdbc.Driver
#jdbc.URL=jdbc:mysql://localhost:3306/b3log?useUnicode=yes&characterEncoding=UTF-8
#jdbc.pool=c3p0
#### JDBC database Configurations ####
jdbc.driver=com.mysql.jdbc.Driver
jdbc.URL=jdbc:mysql://localhost:3306/b3log?useUnicode=yes&characterEncoding=UTF-8
#### H2 runtime ####
runtimeDatabase=H2
jdbc.username=root
jdbc.password=
# database connection pool
#jdbc.pool=BoneCP
#jdbc.pool=druid
jdbc.pool=c3p0
jdbc.driver=org.h2.Driver
jdbc.URL=jdbc:h2:~/b3log_solo_h2/db
jdbc.pool=h2
# The minConnCnt MUST larger or equal to 3
jdbc.minConnCnt=5
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment