NutzCN Logo
问答 nutzboot thymeleaf 如何实现热更新呢
发布于 2052天前 作者 Hamming 1433 次浏览 复制 上一个帖子 下一个帖子
标签:

nutzboot thymeleaf 如何实现热更新呢
如何配置 热更新路径

11 回复

不支持吧,得问问温泉了,我不用thymeleaf

nutzboot 项目 有没有办法 加入 idea 里面 添加的Tomcat 来热部署呢

不引用jetty/tomcat/undertow, 引用nutzboot-servlet3, 应该是可以作为普通web项目启动

配置 如下 能启动 访问 404

<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>
    <groupId>io.nutz</groupId>
    <artifactId>nutzsite</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>war</packaging>
    <properties>
        <nutzboot.version>2.3.3.v20190329</nutzboot.version>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    </properties>
    <dependencyManagement>
        <dependencies>
            <dependency>
                <groupId>org.nutz</groupId>
                <artifactId>nutzboot-parent</artifactId>
                <version>${nutzboot.version}</version>
                <type>pom</type>
                <scope>import</scope>
            </dependency>
        </dependencies>
    </dependencyManagement>
    <dependencies>
       <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-nutz-mvc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-nutz-dao</artifactId>
        </dependency>
        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-servlet3</artifactId>
        </dependency>
<!--        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-jetty</artifactId>
        </dependency>-->
        <!--      <dependency>
           <groupId>org.nutz</groupId>
           <artifactId>nutzboot-starter-tomcat</artifactId>
       </dependency>-->
       <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-quartz</artifactId>
        </dependency>

       <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-shiro</artifactId>
        </dependency>
       <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-thymeleaf</artifactId>
        </dependency>
        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-swagger</artifactId>
        </dependency>
        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-email</artifactId>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-log4j12</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>apache-jsp</artifactId>
        </dependency>
        <dependency>
            <groupId>org.eclipse.jetty</groupId>
            <artifactId>apache-jstl</artifactId>
        </dependency>
        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-nutz-dao</artifactId>
        </dependency>
        <dependency>
            <groupId>org.nutz</groupId>
            <artifactId>nutzboot-starter-jdbc</artifactId>
        </dependency>
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>8.0.11</version>
        </dependency>

        <dependency>
            <groupId>org.sitemesh</groupId>
            <artifactId>sitemesh</artifactId>
            <version>3.0.1</version>
        </dependency>

        <dependency>
            <groupId>commons-codec</groupId>
            <artifactId>commons-codec</artifactId>
            <version>1.11</version>
        </dependency>

        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.8.1</version>
        </dependency>

    </dependencies>
    <repositories>
        <repository>
            <id>nutz</id>
            <url>http://jfrog.nutz.cn/artifactory/libs-release</url>
        </repository>
        <repository>
            <id>nutz-snapshots</id>
            <url>http://jfrog.nutz.cn/artifactory/snapshots</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>nutz-snapshots</id>
            <url>http://jfrog.nutz.cn/artifactory/snapshots</url>
            <snapshots>
                <enabled>true</enabled>
                <updatePolicy>always</updatePolicy>
            </snapshots>
            <releases>
                <enabled>false</enabled>
            </releases>
        </pluginRepository>
    </pluginRepositories>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <compilerArgs>
                        <arg>-parameters</arg>
                    </compilerArgs>
                    <useIncrementalCompilation>false</useIncrementalCompilation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-javadoc-plugin</artifactId>
                <version>2.10.3</version>
                <configuration>
                    <additionalparam>-Xdoclint:none</additionalparam>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.nutz.boot</groupId>
                <artifactId>nutzboot-maven-plugin</artifactId>
                <version>${nutzboot.version}</version>
            </plugin>
        </plugins>
    </build>
</project>

输出日志

/Users/apple/apache-tomcat-8.5.39/bin/catalina.sh run
[2019-04-04 11:34:48,954] Artifact ns:war exploded: Waiting for server connection to start artifact deployment...
Connected to the target VM, address: '127.0.0.1:58916', transport: 'socket'
04-Apr-2019 11:34:54.710 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.5.39
04-Apr-2019 11:34:54.713 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          Mar 14 2019 11:24:26 UTC
04-Apr-2019 11:34:54.713 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.5.39.0
04-Apr-2019 11:34:54.713 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Mac OS X
04-Apr-2019 11:34:54.713 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            10.14.3
04-Apr-2019 11:34:54.713 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          x86_64
04-Apr-2019 11:34:54.713 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             /Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/jre
04-Apr-2019 11:34:54.713 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_201-b09
04-Apr-2019 11:34:54.715 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
04-Apr-2019 11:34:54.715 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         /Users/apple/Library/Caches/IntelliJIdea2019.1/tomcat/Unnamed_ns
04-Apr-2019 11:34:54.715 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         /Users/apple/apache-tomcat-8.5.39
04-Apr-2019 11:34:54.716 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=/Users/apple/Library/Caches/IntelliJIdea2019.1/tomcat/Unnamed_ns/conf/logging.properties
04-Apr-2019 11:34:54.716 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
04-Apr-2019 11:34:54.716 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:58916,suspend=y,server=n
04-Apr-2019 11:34:54.716 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -javaagent:/Users/apple/Library/Caches/IntelliJIdea2019.1/captureAgent/debugger-agent.jar
04-Apr-2019 11:34:54.716 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
04-Apr-2019 11:34:54.717 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
04-Apr-2019 11:34:54.717 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
04-Apr-2019 11:34:54.717 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.password.file=/Users/apple/Library/Caches/IntelliJIdea2019.1/tomcat/Unnamed_ns/jmxremote.password
04-Apr-2019 11:34:54.717 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.access.file=/Users/apple/Library/Caches/IntelliJIdea2019.1/tomcat/Unnamed_ns/jmxremote.access
04-Apr-2019 11:34:54.717 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
04-Apr-2019 11:34:54.717 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
04-Apr-2019 11:34:54.717 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
04-Apr-2019 11:34:54.717 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dorg.apache.catalina.security.SecurityListener.UMASK=0027
04-Apr-2019 11:34:54.717 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dignore.endorsed.dirs=
04-Apr-2019 11:34:54.717 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=/Users/apple/Library/Caches/IntelliJIdea2019.1/tomcat/Unnamed_ns
04-Apr-2019 11:34:54.717 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=/Users/apple/apache-tomcat-8.5.39
04-Apr-2019 11:34:54.717 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=/Users/apple/apache-tomcat-8.5.39/temp
04-Apr-2019 11:34:54.717 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: [/Users/apple/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.]
04-Apr-2019 11:34:54.821 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
04-Apr-2019 11:34:54.848 信息 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
04-Apr-2019 11:34:54.858 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
04-Apr-2019 11:34:54.859 信息 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
04-Apr-2019 11:34:54.859 信息 [main] org.apache.catalina.startup.Catalina.load Initialization processed in 435 ms
04-Apr-2019 11:34:54.881 信息 [main] org.apache.catalina.core.StandardService.startInternal Starting service [Catalina]
04-Apr-2019 11:34:54.881 信息 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.5.39
04-Apr-2019 11:34:54.889 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
04-Apr-2019 11:34:54.899 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
04-Apr-2019 11:34:54.901 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in 42 ms
Connected to server
[2019-04-04 11:34:55,081] Artifact ns:war exploded: Artifact is being deployed, please wait...
04-Apr-2019 11:34:57.144 信息 [RMI TCP Connection(2)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
04-Apr-2019 11:34:57.226 信息 [RMI TCP Connection(2)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
[2019-04-04 11:34:57,265] Artifact ns:war exploded: Artifact is deployed successfully
[2019-04-04 11:34:57,265] Artifact ns:war exploded: Deploy took 2,184 milliseconds
04-Apr-2019 11:35:04.892 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory [/Users/apple/apache-tomcat-8.5.39/webapps/manager]
04-Apr-2019 11:35:04.952 信息 [localhost-startStop-1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
04-Apr-2019 11:35:04.958 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory [/Users/apple/apache-tomcat-8.5.39/webapps/manager] has finished in [65] ms

nutzboot:war
异常

/Library/Java/JavaVirtualMachines/jdk1.8.0_201.jdk/Contents/Home/bin/java -Dmaven.multiModuleProjectDirectory=/Users/apple/IdeaProjects/ns "-Dmaven.home=/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3" "-Dclassworlds.conf=/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/bin/m2.conf" "-javaagent:/Applications/IntelliJ IDEA.app/Contents/lib/idea_rt.jar=53433:/Applications/IntelliJ IDEA.app/Contents/bin" -Dfile.encoding=UTF-8 -classpath "/Applications/IntelliJ IDEA.app/Contents/plugins/maven/lib/maven3/boot/plexus-classworlds-2.5.2.jar" org.codehaus.classworlds.Launcher -Didea.version2019.1 org.nutz.boot:nutzboot-maven-plugin:2.3.3.v20190329:war
[INFO] Scanning for projects...
[WARNING] 
[WARNING] Some problems were encountered while building the effective model for io.nutz:nutzsite:war:1.0-SNAPSHOT
[WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique: org.nutz:nutzboot-starter-nutz-dao:jar -> duplicate declaration of version (?) @ line 82, column 21
[WARNING] 
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING] 
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] 
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building nutzsite 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO] 
[INFO] --- nutzboot-maven-plugin:2.3.3.v20190329:war (default-cli) @ nutzsite ---
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.200 s
[INFO] Finished at: 2019-04-04T11:36:57+08:00
[INFO] Final Memory: 13M/220M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.nutz.boot:nutzboot-maven-plugin:2.3.3.v20190329:war (default-cli) on project nutzsite: Execution default-cli of goal org.nutz.boot:nutzboot-maven-plugin:2.3.3.v20190329:war failed. NullPointerException -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginExecutionException

Process finished with exit code 1

那就是不行咯

nutzboot 从入门到放弃

放到tomcat部署本来就是打包阶段的支持, 并非运行时支持

我只想 热部署 thymeleaf

等温泉改改呗

添加回复
请先登陆
回到顶部