"Project may not be null" error when deploying Platform with SDK

I get the following error when running mvn openmrs-sdk:setup

[ERROR] Failed to execute goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:2.0.2:setup (default-cli) on project openmrs-sdk-tool: Execution default-cli of goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:2.0.2:setup failed: mavenProject may not be null → [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:2.0.2:setup (default-cli) on project openmrs-sdk-tool: Execution default-cli of goal org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:2.0.2:setup failed: mavenProject may not be null

How do I configure the mavenProject which is null

@dmytro_trifonov, have you seen an error like this before?

Hi!

Can you explain the situation in more detail? What parameters for “setup” you used? From which folder you executed this command?

Also, info about your OS and Maven version may be helpful for us. Currently all tasks from SDK works normally (checked on Kubuntu 15.04 with Maven 3.2.1)

Thanks!

@dmytro_trifonov thanks for getting back to me so quickly, below are more details:

My maven configuration from mvn --version

Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T14:57:37+03:00)
Maven home: /usr/local/Cellar/maven/3.3.3/libexec
Java version: 1.7.0_79, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.5", arch: "x86_64", family: "mac"

The command that I run is from the ddirectory /Users/ssmusoke/IdeaProjects/openmrs-sdk:

mvn openmrs-sdk:setup -Dfile=/Users/ssmusoke/IdeaProjects/openmrs-sdk/cbs/cbs.properties -X

properties file:

create_database_user=false
openmrs.platform.version=2.2
dbUser=openmrs
dbUri=jdbc\:mysql\://localhost\:3306/openmrs_sdk?autoReconnect\=true&sessionVariables\=storage_engine\=InnoDB&useUnicode\=true&characterEncoding\=UTF-8
serverId=cbs
connection.driver_class=com.mysql.jdbc.Driver
dbPassword=xxxx
admin_user_password=Admin123
install_method=auto
user_modules=org.openmrs.module/dataintegrity/1.1.3,org.openmrs.module/addresshierarchy/2.2.4,org.openmrs.module/birt/2.3.2.1,org.openmrs.module/custombranding/0.1,org.openmrs.module/formfilter/1.0.0,org.openmrs.module/htmlformentry/1.7.1,org.openmrs.module/htmlwidgets/1.6.4,org.openmrs.module/logic/0.4.1,org.openmrs.module/reportingcompatibility/1.5.8,org.openmrs.module/serialization.xstream/0.2.7
add_demo_data=false
module_web_admin=true
has_current_openmrs_database=true
create_tables=true
database_name=openmrs_sdk
version=1.11.2
auto_update_database=false

It looks like you properties file has invalid attribute - ‘serverId’, it must be called ‘server.id’. Maybe this file was created by previous (unstable) version of SDK?

Please try to change ‘serverId’ to ‘server.id’, and then execute ‘setup’

Also fix some other attributes, see https://wiki.openmrs.org/display/docs/OpenMRS+SDK#OpenMRSSDK-Example

Try to use this:

create_database_user=false
openmrs.platform.version=2.2
connection.username=openmrs
connection.url=jdbc\:mysql\://localhost\:3306/openmrs_sdk?autoReconnect\=true&sessionVariables\=storage_engine\=InnoDB&useUnicode\=true&characterEncoding\=UTF-8
server.id=cbs
connection.driver_class=com.mysql.jdbc.Driver
connection.password=xxxx
admin_user_password=Admin123
install_method=auto
user_modules=org.openmrs.module/dataintegrity/1.1.3,org.openmrs.module/addresshierarchy/2.2.4,org.openmrs.module/birt/2.3.2.1,org.openmrs.module/custombranding/0.1,org.openmrs.module/formfilter/1.0.0,org.openmrs.module/htmlformentry/1.7.1,org.openmrs.module/htmlwidgets/1.6.4,org.openmrs.module/logic/0.4.1,org.openmrs.module/reportingcompatibility/1.5.8,org.openmrs.module/serialization.xstream/0.2.7
add_demo_data=false
module_web_admin=true
has_current_openmrs_database=true
create_tables=true 
database_name=openmrs_sdk
openmrs.version=1.11.2
auto_update_database=false

@dmytro_trifonov updated the properties but still the same error, even after double checking the connection credentials. The tables are also not created in the database

Can you execute

mvn openmrs-sdk:setup

without parameters and then pass parameters in interactive mode. Is it works?

We didn’t test SDK on a Mac, but I’ll do it in nearest time, if there will be problems.

Strange the plain SDK seems to work, I have gone ahead and removed all the parameters from the properties file, which seemed to work with no errors. However the error seems to be tied to the modules configuration, so when I have even one module I get an error.

Thanks for your reply, I found a bug in SDK, and just fixed it in sources. In nearest time we will release a fix version. I will notify you about that.

@dmytro_trifonov maybe you can send me a patch so that I run a test in my environment to verify the bug fix

Ok, but I got another problem, so I need more time.

Can you tell me, “user modules” which listed in the properties file - are they published on maven central or mavenrepo.openmrs.org?

Here is the module list

user_modules=org.openmrs.module/dataintegrity/1.1.3,org.openmrs.module/addresshierarchy/2.2.4,org.openmrs.module/birt/2.3.2.1,org.openmrs.module/custombranding/0.1,org.openmrs.module/formfilter/1.0.0,org.openmrs.module/htmlformentry/1.7.1,org.openmrs.module/htmlwidgets/1.6.4,org.openmrs.module/logic/0.4.1,org.openmrs.module/reportingcompatibility/1.5.8,org.openmrs.module/serialization.xstream/0.2.7

You installed them manually, using mvn openmrs-sdk:install ?

@dmytro_trifonov I added them to the properties file, and what I have seen is that they are not downloaded in the modules directory of the at /Users/ssmusoke/openmrs//modules as I would expect. Not sure if the configuration is right, I assume that it is.

Modules can be loaded from:

  1. Local Maven repository
  2. Maven central
  3. OpenMRS Maven repository

It seems like some of you modules (for example, dataintegrity) doesn’t published on central or OpenMRS repository (which is http://mavenrepo.openmrs.org/). But maybe they are installed in you local repo?. Please check it before trying to setup a server.

You may try to use plugin from sources, where I fixed bug with “null MavenProject”

git clone https://github.com/diospark/openmrs-contrib-sdk-maven-plugin.git
cd openmrs-contrib-sdk-maven-plugin
mvn clean install

and then use local version of SDK:

mvn org.openmrs.maven.plugins:openmrs-sdk-maven-plugin:2.0-SNAPSHOT:<command> [parameters].
  1. @dmytro_trifonov just noticed another bug with the SDK, it only downloads the first module in the user_modules list.

  2. Another question, there is a default modules list for the platform that is downloaded as part of setup, however in my case I am using some older versions of the modules, does the list in the SDK constants ever get updated or merged with what is in the properties file?

  3. The current error I am getting from the snapshot is Caused by: java.lang.NullPointerException at org.openmrs.maven.plugins.utility.PropertyManager.replaceDbNameInDbUri(PropertyManager.java:160), however I have corrected all the constants to match the names on the page.

Thanks for all your assistance and support with this

  1. You mean, that setup finished successfully, but only one module was loaded?
  2. The feature of installing user modules was designed for testing modules, which is user develops. We don’t expect that this modules will be the part of OpenMRS distro. So, when you will try to install modules, which higher versions already installed, it may cause problems. It will be better to download them manually, and put them to $HOME/openrms/*SERVER_ID*/modules folder
  3. Can you put there command, attributes and full log for this error? Thanks!

@dmytro_trifonov I suspect that I was using the SDK in a way that it was not meant to be used, so I have changed tactics and am now using a distro approach just like the reference application to build the required modules for distribution. Thanks for your assistance, and patience with the back and forth.