Short version
When I change resources in my app, then attempt to hot-deploy them, the files are deleted instead of updated from the target/
directory and I don't understand why.
Long version
I have a Java 8 + Tomcat 8 + Spring Boot + Thymeleaf project that I'm running out of IntelliJ. When I change files, such as CSS files from the src/main/resources/static/css
directory, and run Update Resources
or Update classes and resources
, the file is deleted from target/classes/static/css
instead of updated. Nothing is printed in the Tomcat logs about the file, nothing is printed in the IntelliJ logs (in ~/Library/Logs/IntelliJIdea13/idea.log
) about deleting the file... it just disappears.
Tomcat 8 is set up as an external application server (not the built-in Spring Boot embedded server) with the following config. The only thing I've customized in the IntelliJ Run Configuration setup is to have specified CATALINA_BASE
to the same value as the "Tomcat Base", like so:
Tomcat Home: /usr/local/tomcat8
Tomcat Base: /path/to/my/catalina/base
Java Env Vars: CATALINA_BASE=/path/to/my/catalina/base
... If I don't, CATALINA_BASE is set to /Users/me/Library/Caches/IntelliJIdea13/tomcat/Unnamed_demo_app
, which seems to be a non-working clone of my real catalina base and I get 404's everywhere. This may be a red herring here, or the key to the mystery.
Extra, probably useless info
Here's the 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 is configured to do WAR deployments, with a custom catalina base containing a stock conf/server.xml
and conf/web.xml
, and various 3rd party libraries provided in lib
.
Here's my 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>
<!-- for 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 really what is worth telling about this issue otherwise, though it doesn't feel like what I've provided is useful. Add a comment if there's any info I should add.