Development mode not working


#1

Enonic version: 6.12.1
OS: Windows 10

After I adapted my gradle scripts to be 6.x compatible, dev mode is no longer working. I was hoping someone in here could shed som light on what might be causing this.

Here is my build.gradle script:
plugins {
id ‘java’
id ‘com.enonic.xp.app’ version ‘1.0.13’
id ‘com.moowork.node’ version ‘1.2.0’
}

xp {
version = xpVersion
}

app {
name = project.appName
displayName = project.displayName
vendorName = project.vendorName
vendorUrl = project.vendorUrl
}

sourceSets {
main {
resources {
srcDir ‘site’
}
}
}

def frontendDir = “.”

// ##
// ## Application tasks
// ##
task prepareProduction {
group ‘application’
description ‘Builds and deploys entire application, including frontend npm build’
mustRunAfter(‘npmBuild’)
dependsOn(‘npmBuild’)
}

task buildProduction {
mustRunAfter(‘prepareProduction’)
dependsOn(‘prepareProduction’)
dependsOn(‘build’)
}

// ##
// ## Frontend/npm tasks
// ##
task npmInstallDeps(type: NpmTask,
group: ‘node’,
description: ‘Install all npm deps’
) {
args = [‘install’]
}

task npmBuild(
type: NpmTask,
group: ‘node’,
description: ‘Build npm frontend project (package.json)’,
dependsOn: npmInstallDeps) {
args = [‘run’, ‘build’]
}

task npmBuildDevelopment(
type: NpmTask,
group: ‘node’,
description: ‘Build npm frontend project for development (package.json)’,
dependsOn: npmInstallDeps
) {
args = [‘run’, ‘buildDevelopment’]
}

dependencies {
compile “com.enonic.xp:core-api:${xpVersion}”
compile “com.enonic.xp:portal-api:${xpVersion}”
include “com.github.tineikt:xp-lib-freemarker:0.9.3”
include “com.enonic.xp:lib-content:${xpVersion}”
include “com.enonic.xp:lib-portal:${xpVersion}”
include “com.enonic.xp:lib-thymeleaf:${xpVersion}”
include “com.enonic.xp:lib-auth:${xpVersion}”
include ‘com.enonic.lib:lib-http-client:1.0.0’
include ‘com.enonic.lib:lib-cache:1.1.0’
//include “com.enonic.xp:lib-xslt:${xpVersion}”
//include “com.enonic.xp:lib-mustache:${xpVersion}”
//include “com.enonic.xp:lib-i18n:${xpVersion}”
//include “com.enonic.xp:lib-context:${xpVersion}”
//include “com.enonic.xp:lib-io:${xpVersion}”
//include “com.enonic.xp:lib-mail:${xpVersion}”
//include “com.enonic.xp:lib-websocket:${xpVersion}”
}

repositories {
mavenLocal()
jcenter()
xp.enonicRepo()
maven {
url ‘https://jitpack.io
}
}

node {
// Version of node to use.
version = ‘8.7.0’

// Version of npm to use.
npmVersion = '5.3.0'

download = true

// Set the work directory where node_modules should be located
nodeModulesDir = file(frontendDir)

}

task wrapper(type: Wrapper) {
gradleVersion = ‘2.9’
}


#2

First thing to check at least, the project states use of gradle 2.9 - make sure to update to a newer version of Gradle.


#3

Right! Thanks.
Am I right when I say that development mode in enonic “reads” js / html / css files directly from my projectfiles, and not from the generated jar file?


#4

That is right, this is why you don’t need to redeploy to see the changes.


#5

Ok. What part of the gradle config tells enonic to look in the project files when in dev mode?


#6

There is nothing special needed in the gradle config. The magic happens when you start Enonic in dev mode and deploy an app. Apps automatically contain the development directory in the build metadata. XP uses this to locate and monitor your applications code directory.


#7

Ok. Thanks for the info. Then I am really wondering how I have messed up dev mode locally.


#8

Try setting up your gradle script from scratch using the latest vanilla starter and then add new config items until you hit the problem. https://market.enonic.com/vendors/enonic/vanilla-starter


#9

Ok. Tried setting up a project from scratch using vanilla starter, and development mode is still not working.
Must be something with my environment then.


#10

Could you share exactly what is not working for you? There are things that will still require a redeploy. I.e. adding new content types, Java etc.


#11

What I want to achieve is just the normal development mode working.
Especially changes in html template files and css. It is really painful to wait for the deploy to finish before I can actually see my changes.


#12

Does the server print the following text when it starts?

´DEV mode is ON. This will slow down the system and should NOT BE used in production.´

Try uninstalling the app and make sure it is not listed in ‘Applications’, then do a gradlew clean deploy and make sure the terminal / log prints Application [...] installed successfully. Now when changing stuff (except some changes in certain xml files or perhaps imported library js) in your source code, it should be picked up by dev mode.

You are not using debug mode at the same time? I have previously experienced trouble with using the two together.

Another tip is to try out the https://market.enonic.com/vendors/gustaf-ekeberg/se.gustafekeberg.livereload app. Attach it to the site you are working on and use http://livereload.com on mac or similar on windows to detect changes in html / css etc. without even reloading your browser.


#13

It says DEV mode is on when I boot up the server yes. I am not using “debug mode” as far as I know. Where is this setting specificed?

I will try to uninstall the app and do the gradlew clean deploy now


#14

debug can be added to startup with ./bin/server debug the same way as ./bin/server dev is used for dev-mode, but using the two at the same time have caused a very slow experience at times. useful when debugging java code. this does not sound like your problem, just checking…


#15

If no success, i would also try to stop the server, delete the xp.home/work folder, and try again. there might be some cacheing of osgi bundles there.


#16

Hi again! We have discovered and fixed a bug in xp gradle plugin version1.0.17. The bug prevented dev mode from working on Windows. Can you try again with this fix? https://github.com/enonic/xp-gradle-plugin/issues/9


#17

Wow! Awesome! I will test right away-


#18

Changed to version 1.0.17 of the plugin and development mode is working again! :slight_smile:


#19