handle separate configDirectory and configFile
@@ -277,10 +277,12 @@ public class DevMojo extends StartDebugMojoSupport {
startDefaultServer();
+ boolean noConfigDir = false;
// config files
- if (configDirectory == null) {
+ if (configDirectory == null || !configDirectory.exists()) {
configDirectory = configFile.getParentFile();
+ noConfigDir = true;
log.debug("configDirectory set to: " + configDirectory.getAbsolutePath());
}
@@ -366,12 +368,17 @@ public class DevMojo extends StartDebugMojoSupport {
deleteJavaFile(fileChanged, testOutputDirectory, testSourceDirectory);
}
} else if (directory.startsWith(configDirectory.toPath())) { // config files
- if (fileChanged.exists() && (event.kind() == StandardWatchEventKinds.ENTRY_MODIFY || event.kind() == StandardWatchEventKinds.ENTRY_CREATE)) {
+ if (fileChanged.exists() && (event.kind() == StandardWatchEventKinds.ENTRY_MODIFY
+ || event.kind() == StandardWatchEventKinds.ENTRY_CREATE)) {
+ if (!noConfigDir || fileChanged.getAbsolutePath().endsWith(configFile.getName())) {
copyFile(fileChanged, configDirectory, serverDirectory);
+ }
} else if (event.kind() == StandardWatchEventKinds.ENTRY_DELETE) {
- log.debug("Config file deleted: " + fileChanged.getName());
+ if (!noConfigDir || fileChanged.getAbsolutePath().endsWith(configFile.getName())) {
+ log.info("Config file deleted: " + fileChanged.getName());
deleteFile(fileChanged, configDirectory, serverDirectory);
}
+ }
} else if (resourceParent != null && directory.startsWith(resourceParent.toPath())){ // resources
log.debug("Resource dir: " + resourceParent.toString());
log.debug("File within resource directory");
@@ -945,20 +952,6 @@ public class DevMojo extends StartDebugMojoSupport {
}
- private boolean warXmlExists(File dir){
- boolean looseApp = false;
- if (dir.exists() && dir.isDirectory()) {
- File[] files = dir.listFiles();
- for (File file : files) {
- if (file.isFile() && file.getName().endsWith(".war.xml") && file.getName().startsWith(DevMojo.this.project.getArtifactId())) {
- looseApp = true;
- break;
- }
- }
- }
- return looseApp;
- }
-
private void listFiles(File directory, List<File> files, String suffix) {
if (directory != null) {
// Get all files from a directory.
