solo博客开源地址

项目地址:GitHub - 88250/solo: B3log 分布式社区的 Java 博客端节点系统,欢迎加入下一代社区网络。B3log distributed community blog-end node based on Java, welcome to join the next generation community network.

本地运行

本地运行主要用于试用或者生成静态站点,生成静态站点的用法请参考这里。(视频演示教程请看这里

下载最新的 Solo 包解压,进入解压目录执行:

  • Windows: java -cp "lib/*;." org.b3log.solo.Server
  • Unix-like: java -cp "lib/*:." org.b3log.solo.Server

启动所有参数如下,仅做参考:

--listen_port <LISTEN_PORT>                           listen port, default is 8080
--lute_http <LUTE_HTTP>                               lute http URL, default is http://localhost:8249, see
--runtime_mode <RUNTIME_MODE>                         runtime mode (DEVELOPMENT/PRODUCTION), default is DEVELOPMENT
--server_host <SERVER_HOST>                           browser visit domain name, default is localhost
--server_port <SERVER_PORT>                           browser visit port, default is 8080
--server_scheme <SERVER_SCHEME>                       browser visit protocol, default is http
--static_path <STATIC_PATH>                           browser visit static resource path, default is empty
--static_server_host <STATIC_SERVER_HOST>             browser visit static resource domain name, default is
--static_server_port <STATIC_SERVER_PORT>             browser visit static resource port, default is 8080
--static_server_scheme <STATIC_SERVER_SCHEME>         browser visit static resource protocol, default is http
--unix_domain_socket_path <UNIX_DOMAIN_SOCKET_PATH>   unix domain socket path

IDEA 编译执行

默认使用Java环境,Java版本需要高于1.8,这里使用 jdk17版本;

默认直接编译

在这里插入图片描述

jar启动方式失败:直接启动打包生成的solo.jar

D:\work\solo\target>java -jar solo.jar
错误: 找不到或无法加载主类 org.b3log.solo.Server
原因: java.lang.NoClassDefFoundError: org/b3log/latke/http/BaseServer

推荐启动:进入solo文件夹下,启动成功;

D:\work\solo\target\solo>java -cp "lib/*;." org.b3log.solo.Server
[WARN ]-[2024-10-16 16:40:50]-[org.b3log.latke.Latkes:713]: !!!!Runtime mode is [DEVELOPMENT], please make sure configured it with [PRODUCTION] in latke.properties if deployed on production environment!!!!
[INFO ]-[2024-10-16 16:40:50]-[org.b3log.solo.Server:259]: Solo is booting [ver=4.4.0, os=Windows 11, isDocker=false, inJar=false, luteAvailable=false, pid=28336, runtimeDatabase=MYSQL, runtimeMode=DEVELOPMENT, jdbc.username=xdtian, jdbc.URL=jdbc:mysql://124.71.65.251:3309/solo?useUnicode=yes&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true]
[INFO ]-[2024-10-16 16:40:52]-[org.b3log.solo.util.Skins:73]: Loaded template from classpath
[INFO ]-[2024-10-16 16:40:53]-[org.b3log.solo.Server:306]: Solo is running

jar 包编译

请在 pom.xml 中搜索 maven-assembly-plugin 的注释进行配置即可。请注意:使用 jar 运行不支持:

  • 静态站点生成
  • 可能存在其他未知问题,测试发现看板娘等第三方组件无法使用。

==建议尽量不要打 jar 部署,服务器上请通过 Docker 部署。==但是我服务器资源有限,不想安装docker,直接以编译包的形式运行,节省资源。

pom.xml 中该<plugin>段注释内容放开,然后 maven 编译 package

<!--            <plugin>-->
<!--                <artifactId>maven-assembly-plugin</artifactId>-->
<!--                <configuration>-->
<!--                    <descriptors>-->
<!--                        <descriptor>src/assembly/bin.xml</descriptor>-->
<!--                    </descriptors>-->
<!--                </configuration>-->
<!--                <executions>-->
<!--                    <execution>-->
<!--                        <id>make-assembly</id>-->
<!--                        <phase>package</phase>-->
<!--                        <goals>-->
<!--                            <goal>single</goal>-->
<!--                        </goals>-->
<!--                    </execution>-->
<!--                </executions>-->
<!--            </plugin>-->

            <!-- 需要打 jar 部署的话注释掉上面的配置,启用下面这段配置-->
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <configuration>
                    <appendAssemblyId>false</appendAssemblyId>
                    <descriptorRefs>
                        <descriptorRef>jar-with-dependencies</descriptorRef>
                    </descriptorRefs>
                    <archive>
                        <manifest>
                            <mainClass>org.b3log.solo.Server</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <id>make-assembly</id>
                        <phase>package</phase>
                        <goals>
                            <goal>assembly</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

打包后target目录下的 solo.jar 可直接运行。

D:\work\solo\target>java -jar solo.jar
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
[WARN ]-[2024-10-16 16:48:27]-[org.b3log.latke.Latkes:713]: !!!!Runtime mode is [DEVELOPMENT], please make sure configured it with [PRODUCTION] in latke.properties if deployed on production environment!!!!
[INFO ]-[2024-10-16 16:48:28]-[org.b3log.solo.processor.console.StaticSiteConsole:161]: Do not support export static site when running in jar
[INFO ]-[2024-10-16 16:48:28]-[org.b3log.solo.Server:259]: Solo is booting [ver=4.4.0, os=Windows 11, isDocker=false, inJar=true, luteAvailable=false, pid=10780, runtimeDatabase=MYSQL, runtimeMode=DEVELOPMENT, jdbc.username=xdtian, jdbc.URL=jdbc:mysql://124.71.65.251:3309/solo?useUnicode=yes&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC&allowPublicKeyRetrieval=true]
[INFO ]-[2024-10-16 16:48:29]-[org.b3log.solo.service.ImportService:76]: Ignored import markdowns when running in jar
[INFO ]-[2024-10-16 16:48:30]-[org.b3log.solo.util.Skins:73]: Loaded template from classpath
[INFO ]-[2024-10-16 16:48:30]-[org.b3log.solo.Server:306]: Solo is running

点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论

微信公众账号

微信扫一扫加关注

发表
评论
返回
顶部