tomcat - "Update Resources" in IntelliJ deletes updated files from target directory -
short version
when change resources in app, attempt hot-deploy them, files deleted instead of updated target/
directory , don't understand why.
long version
i have java 8 + tomcat 8 + spring boot + thymeleaf project i'm running out of intellij. when change files, such css files src/main/resources/static/css
directory, , run update resources
or update classes , resources
, file deleted target/classes/static/css
instead of updated. nothing printed in tomcat logs file, nothing printed in intellij logs (in ~/library/logs/intellijidea13/idea.log
) deleting file... disappears.
tomcat 8 set external application server (not built-in spring boot embedded server) following config. thing i've customized in intellij run configuration setup have specified catalina_base
same value "tomcat base", so:
tomcat home: /usr/local/tomcat8 tomcat base: /path/to/my/catalina/base java env vars: catalina_base=/path/to/my/catalina/base
... if don't, catalina_base set /users/me/library/caches/intellijidea13/tomcat/unnamed_demo_app
, seems non-working clone of real catalina base , 404's everywhere. may red herring here, or key mystery.
extra, useless info
here's relevant (but uninteresting) output in idea.log
:
info - ij.compiler.impl.compiledriver - compilation started (build process) info - j.compiler.server.buildmanager - builder_process [stdout]: build process started. classpath: /applications/intellij idea 13.app/lib/jps-launcher.jar:/library/java/javavirtualmachines/jdk1.8.0_31.jdk/contents/home/lib/tools.jar:/applications/intellij idea 13.app/lib/optimizedfilemanager.jar:/applications/intellij idea 13.app/lib/ecj-4.3.2.jar info - lij.compiler.impl.compilerutil - compilation finished (build process); errors: 0; warnings: 0 took 3709 ms: 0 min 3sec
the app configured war deployments, custom catalina base containing stock conf/server.xml
, conf/web.xml
, , various 3rd party libraries provided in lib
.
here's pom:
<?xml version="1.0" encoding="utf-8"?> <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>com.example</groupid> <artifactid>myapp</artifactid> <version>0.1-beta</version> <packaging>war</packaging> <properties> <spring-boot-version>1.2.1.release</spring-boot-version> <spring-version>4.1.4.release</spring-version> </properties> <parent> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.2.1.release</version> </parent> <dependencies> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-thymeleaf</artifactid> <version>${spring-boot-version}</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-security</artifactid> <version>${spring-boot-version}</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-data-jpa</artifactid> <version>${spring-boot-version}</version> <scope>provided</scope> </dependency> <dependency> <groupid>mysql</groupid> <artifactid>mysql-connector-java</artifactid> <version>5.1.34</version> <scope>provided</scope> </dependency> <dependency> <groupid>org.webjars</groupid> <artifactid>dojo</artifactid> <version>1.10.0</version> <scope>provided</scope> </dependency> <dependency> <!-- equals/hash/tostring builder --> <groupid>org.apache.commons</groupid> <artifactid>commons-lang3</artifactid> <version>3.0.1</version> <scope>provided</scope> </dependency> <dependency> <!-- spring/mail integration --> <groupid>javax.mail</groupid> <artifactid>mail</artifactid> <version>1.4.7</version> <scope>provided</scope> </dependency> <dependency> <!-- spring/mail integration --> <groupid>org.springframework</groupid> <artifactid>spring-context-support</artifactid> <version>${spring-version}</version> <scope>provided</scope> </dependency> <dependency> <!-- connection pooling --> <groupid>com.zaxxer</groupid> <artifactid>hikaricp</artifactid> <version>2.3.5</version> <scope>provided</scope> </dependency> </dependencies> </project>
i'm not sure worth telling issue otherwise, though doesn't feel i've provided useful. add comment if there's info should add.
i guessing using maven plugin.
by default, src/main/resources folder added application classpath when run application , duplicate found in target/classes removed. allows hot refreshing of resources can useful when developing web applications. example, can work on html, css or javascipt files , see changes without recompiling application. helpful way of allowing front end developers work without needing download , install java ide.
if can start application right idea (just run main class) that. otherwise, disable feature configuring plugin:
<build> ... <plugins> ... <plugin> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-maven-plugin</artifactid> <version>1.2.3.release</version> <configuration> <addresources>false</addresources> </configuration> </plugin> ... </plugins> ... </build>
http://docs.spring.io/spring-boot/docs/current/maven-plugin/usage.html
Comments
Post a Comment