sdk failure when using the watch goal

I’ve created a platform 2.0 server with the sdk and deployed radiology using the deploy goal. But when use openmrs-sdk:watch to do live reloads the server will fail with the following error if I restart it. And when I don’t restart there is no live reload. I’d still have to rebuild and redeploy the module for every single javascript change I make.

Below is the error I get when I restart the server after using the watch goal

[INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal com.mycila:license-maven-plugin:3.0:format (format-license-header) on project radiology-api: Execution format-license-header of goal com.mycila:license-maven-plugin:3.0:format failed: Cannot read header document license-header.txt. Cause: Resource license-header.txt not found in file system, classpath or URL: no protocol: license-header.txt -> [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 [ERROR] [ERROR] After correcting the problems, you can resume the build with the command [ERROR] mvn -rf :radiology-api [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.714 s [INFO] Finished at: 2017-06-21T12:20:47+01:00 [INFO] Final Memory: 19M/309M [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:3.10.1:run (default-cli) on project standalone-pom: Execution default-cli of goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:3.10.1:run failed: Failed to build project in /Users/ivange/openmrs/platform-2-0-gsoc/temp-project: Failed building project in /Users/ivange/openmrs/platform-2-0-gsoc/temp-project -> [Help 1]

Note: When I don’t use the watch goal, I can restart the server multiple times after deploy radiology with no issues. This error only pops up when using openmrs-sdk:watch

Even the deploy command does work like expect it to be. When I run openmrs-sdk:deploy from the project root directory I expect it to deploy the local instance I’m working on but it doesn’t seem to do that. It even asks me if I want to deploy the snapshot .omod I just built and I always take yes but I just noticed it’s deploying something else. Maybe from official openmrs repos but definitely not the version I’m working because I don’t see my changes from the UI but when I delete it and do a manual install using the upload button. I can see my changes fine.

Can you please try disabling the license-maven-plugin in radiology’s pom.xml?

It’s deploying the latest SNAPSHOT of that project from your local repo (if you haven’t built it for a while with ‘mvn clean install’, it may be a version from mavenrepo.openmrs.org). Please build the project with ‘mvn clean install’ and then deploy or you can combine two commands into one as follows ‘mvn clean install openmrs-sdk:deploy’. Note that you have to use ‘install’ and not ‘package’

1 Like

Disabled it and it works now.[quote=“raff, post:3, topic:11969”] Note that you have to use ‘install’ and not ‘package’ [/quote]

Yes this was the problem. I always built with package. When I used install it deployed the instance I’m working on thanks.

But unfortunately I still don’t get live reload. When I make a change to my jsp it does not reflect when I reload the browser. I tried rebuilding the .jsp file but that didn’t work too.

I do not think that tool was meant for jsp reloading. You may need to use something like FileSync as mentioned here https://ssmusoke.com/2015/09/24/openmrs-module-development-learnings-102/

Can we still use the above method… (using filesync in IDE) Only this time using sdk to reflect changes instead of the stand alone? @dkayiwa @ssmusoke

Am facing similar challenges… I need to see changes done in my in IDE reflected in browser pages UI whose server is the SDK,Not the standalone embedded server??

It’s definitely possible to use FileSync or a similar tool with SDK. The folder to sync on the server is path_to_sdk_server\tmp\openmrs\WEB-INF\view…