5

I created a new "Configuration form" screen which contains several text inputs. My goal is to use these inputs variables and merge them into a properties file.

I'm using version 6.1.6 - so I created "Modify a ZIP file" action for that purpose and placed it under the installer's Install files. In the "Modification actions" property of the action I created new "Write properties to file" action and inside it under the "Source of property definitions" I choose the Installer variable option. It then let me bound the variables I defined earlier which makes sense.

My problem is after running the installer the properties file won't get update. When opening the installation.log I have the next message:

[ERROR] com.install4j.runtime.beans.actions.properties.WritePropertiesFileAction [ID 1540]: Properties source variable db.database is not an instance of java.util.Map
  1. How can I define the variable to be as a Map type?
  2. I wasn't sure about where exactly place the "Modify a ZIP file" action - is keeping it under the Install files section is fine or should I place it right under the new "Configuration form" I created?

UPDATE:

I set my variable name to be: "${installer:db.database}" which should place it within a Map and now I'm still getting an error:

[ERROR] com.install4j.runtime.beans.actions.properties.WritePropertiesFileAction [ID 1540]: Properties source variable postgres has not been set
Nimrod
  • 1,100
  • 1
  • 11
  • 27

1 Answers1

2

under the "Source of property definitions" I choose the Installer variable option.

In that case you would have to set an installer variable to a map with all variable definitions that should be saved to the property file.

I would rather set the "Source of property definitions" property to "Direct entry". In the "Property definitions" child property add definitions for all properties like this:

A=${installer:A}
B=${installer:B}
...
Ingo Kegel
  • 46,523
  • 10
  • 71
  • 102
  • It works, thanks! I have another small question please. In the properties file I have the next property: **db.url=jdbc:postgresql://localhost:5432** In the configuration form I created 2 inputs: 1 is for the server URL and another for the server port. In the properties file they are both on the same property (localhost:5432). Is there any way update each part separately without creating new property in the properties file? – Nimrod Oct 30 '17 at 16:08
  • 1
    The installer variables are simply replaced in the "Property definitions" property, so `db.url=${installer:host}:${installer:port}` should be what you need. – Ingo Kegel Oct 30 '17 at 21:33