Generating Your Project

This page shows you how to generate your project from the TrueLicense Maven Archetype. Generating a project from the archetype involves customizing a set of property values as explained below.

Important Notes

  1. If you want to change the value of any of the following properties then it’s generally necessary to generate another project from the TrueLicense Maven Archetype.
  2. For any two generated projects, their license keys are not compatible even if all property values are equal, unless both projects also share a copy of the same key store files (see below):
    • ${artifactId}-keygen/src/main/resources/${privateKeyStoreFile},
    • ${artifactId}-keymgr/src/main/resources/${ftpKeyStoreFile} and
    • ${artifactId}-keymgr/src/main/resources/${publicKeyStoreFile}.

Basic Configuration

This is a basic configuration example for a software product with only one edition with the name standard and no free trial period.

$ mvn archetype:generate -B \
    -DarchetypeGroupId=net.truelicense \
    -DarchetypeArtifactId=truelicense-maven-archetype \
    -DarchetypeVersion=3.2.0 \
    -DartifactId='basic' \
    -Dcompany='Company Inc.' \
    -DgroupId='com.company.product' \
    -Dpassword='test1234' \
    -Dsubject='Product 1' \
    -Dversion='1.0-SNAPSHOT'
[...]

For customization, please copy the preceding sample command, edit the property values to match your licensing schema and paste the result into a shell. Throughout this tutorial, a leading $ indicates a shell prompt and a [...] indicates command output, so please don’t copy/paste these. The properties archetypeArtifactId, archetypeGroupId and archetypeVersion reference the TrueLicense Maven Archetype itself, so you shouldn’t change their values. All other property values are customizable as explained in the following reference.

Occasionally you may also see an expression starting with a $, followed by a name in braces. This is a reference to the value of the named property. For example, assuming that the project is generated as shown above, the expression ${package} is a reference to the value com.company.product. This syntax has been borrowed from Apache Maven.

Upon successful execution, a new directory with the artifact ID as its name exists in the current directory. For the rest of this documentation, all commands assume that this is the current directory, so you need to change to it now:

$ cd ${artifactId}

Property Reference

Following is the list of properties for generating a project from the TrueLicense Maven Archetype in alphabetic order. Note that property values are generally case sensitive.

Required Properties

Description
The Maven artifact ID of the root POM for the generated project. This could match the name of your software product, e.g. product, or be generic, e.g. license.
Type
ArtifactId: A Maven artifact ID must not contain spaces and should consist of only lower-case characters - see Maven - POM Reference - Maven Coordinates .
Description
The display name of your company, e.g. Company Inc..
Type
token
Description
The Maven group ID for the generated project. This could be the reversed domain name for your company plus the name of the software product.
Type
GroupId: A Maven group ID must not contain spaces and should consist of only lower-case characters - see Maven - POM Reference - Maven Coordinates .
Description
The common password for accessing key stores and encrypting license keys.
Type
Password: A string of at least eight characters which must contain letters and digits. You should consider this to be the bare minimum. Choosing a longer password with additional punctuation characters significantly improves the security level of your licensing schema.
Description
The license management subject. The value of this property gets stored in the generated license keys and is used for validation. A net.truelicense.api.LicenseValidationException is thrown if the validation fails. It's best practice to include the name of your software product and a version number range for which the license keys are valid, e.g. Product 1 or Product 1.X. The license validation step compares the entire string, so the version number format doesn't matter. If you want to obsolete existing license keys in a future release then all you need to do is to change the value, e.g. to Product 2 or Product 2.X.
Type
token
Description
The Maven version for the generated project. This should match the version of your software product.
Type
Version: A Maven version must conform to the Maven version number requirements. See also Maven - POM Reference - Maven Coordinates .

Optional Properties

Description
The display name of the parent POM for the generated project. This could be the name of your software product, e.g. Product, or be generic, e.g. License.
Type
token
Default
-
Description
Declares the scope of the class path for the custom classes referenced by the properties with the name pattern *Class.
Type
CustomClasspathScope: One of compile or runtime. Select compile to declare that custom classes are available on the class path at compile time. The generated code will instantiate the classes using the new operator. The advantage is that the classes can be safely included in the byte code obfuscation process. The disadvantage is that the classes need to be known at compile time so that manual editing of the dependencies in the generated POM files for the Key Generator or Key Manager module may be necessary. Select runtime to declare that custom classes are available on the class path at runtime only. The generated code will instantiate the classes using the Java Reflection API. The advantage is that the classes don't need to be known at compile time so that manual editing of the generated POM files should not be necessary. The disadvantage is that the classes need to be generally excluded from the byte code obfuscation process, e.g. for the Key Manager module. This is considered to be a security leak and therefore should be generally avoided. However, this is not true for ProGuard: TrueLicense generates code for dynamic class loading which is correctly recognized and obfuscated by ProGuard so that it's safe to use this option with ProGuard.
Default
compile
Description
Whether or not the Swing wizard dialog in the Key Manager module should be disabled. Select true to cut the dependency on the TrueLicense Swing module and reduce the code size.
Type
boolean
Default
false
Description
A space separated list of edition names, ordered from supersets to subsets, e.g. enterprise standard. Each name must be a valid Java identifier name and should be camel-cased with a lower-case initial character. The names edition and ftp are reserved for internal use.
Type
JavaIdentifierList: A space separated list of valid identifiers in the Java language.
Default
standard
Description
The number of days for an auto-generated FTP. Needs to be a non-negative integer, e.g. 30. Specify 0 to disable the auto-generation of FTP license keys.
Type
nonNegativeInteger
Default
0
Description
The path of the FTP key store file in the Key Manager module relative to the base path ${artifactId}-keymgr/src/main/resources/ . This property is ignored if the property freeTrialPeriod is set to 0. Otherwise, if the value is set to -, then it gets overridden with the value of the property publicKeyStoreFile.
Type
token
Default
-
Description
A fully qualified binary class name which declares the user or system preferences node to use for storing the auto-generated FTP license key. This property is ignored if the property freeTrialPeriod is set to 0. Otherwise, the package name of the referenced class needs to be kept absolutely secret because removing the FTP license key from the preferences node triggers the auto-generation of another FTP license key! The named class gets dynamically loaded at run time, so it doesn't have to be on the compile time class path of the Key Manager module.
Type
token
Default
-
Description
Whether or not the Swing wizard dialog in the Key Manager module should hide the action for uninstalling the license key.
Type
boolean
Default
false
Description
A fully qualified binary class name which implements the interface net.truelicense.api.LicenseManagementAuthorization for use in the Key Generator module. Select - to use no license authorization.
Type
token
Default
-
Description
A fully qualified binary class name which implements the interface net.truelicense.api.LicenseValidation for use in the Key Generator module. Select - to use only the built-in license validation function.
Type
token
Default
-
Description
Selects the composition strategy for license validation functions in the Key Generator module. This property is ignored if the property keyGenValidationClass is set to -.
Type
LicenseFunctionComposition: One of decorate or override. Select override to apply only the custom function. Select decorate to apply both the custom function and the built-in function.
Default
decorate
Description
A fully qualified binary class name which implements the interface net.truelicense.api.LicenseManagementAuthorization for use in the Key Manager module. Select - to use no license authorization.
Type
token
Default
-
Description
A fully qualified binary class name which implements the interface net.truelicense.api.util.Clock for use in the Key Manager module. Select - to use the system clock.
Type
token
Default
-
Description
A fully qualified binary class name which implements the interface net.truelicense.api.LicenseValidation for use in the Key Manager module. Select - to use only the built-in license validation function.
Type
token
Default
-
Description
Selects the composition strategy for license validation functions in the Key Manager module. This property is ignored if the property keyMgrValidationClass is set to -.
Type
LicenseFunctionComposition: One of decorate or override. Select override to apply only the custom function. Select decorate to apply both the custom function and the built-in function.
Default
decorate
Description
The algorithm to use when generating key pairs in the key store files on the first build. This property is ignored if the key store files already exist. The algorithm needs to be supported by one of the security providers which are installed in the JRE.
Type
KeyPairAlgorithm: One of auto, DSA, EC or RSA.
Default
auto
Description
The key size in bits when generating key pairs in the key store files at the first build. This property is ignored if the key store files already exist. Otherwise, if the value is set to 0, then the default value of the keytool is used. Otherwise, the bit size needs to match the configured ${keyPairAlgorithm} and be supported by one of the security providers which are installed in the JRE/JDK.
Type
nonNegativeInteger
Default
0
Description
The default key store type. The type needs to be supported by one of the security providers which are installed in the JRE. If the value is set to auto, then it gets overridden as follows: If the value of the licenseKeyFormat property is set to V1, then this gets set to JKS, otherwise it gets set to JCEKS.
Type
KeyStoreType: One of auto, JCEKS, JKS or PKCS12. PKCS12 requires Java SE 8.
Default
auto
Description
The format of the license keys. Select V1 if you need to retain compatibility with license keys generated with TrueLicense 1. Otherwise, select V2/XML if you want to exclude an additional dependency on the Jackson JSON Processor. Otherwise, select V2/JSON for the smallest license keys and the fastest processing.
Type
LicenseKeyFormat: One of V1, V2/JSON or V2/XML.
Default
V2/JSON
Description
The base package name of the generated project. It's best practice to use the expression ${groupId} or ${groupId}.${artifactId} if this results in a valid package name. If this property is undefined, then the Maven Archetype Plugin sets its value to ${groupId}.
Type
token
Description
The algorithm for the password based encryption. The algorithm needs to be supported by one of the security providers which are installed in the JRE. If the value is set to auto, then it gets overridden as follows: If the value of the licenseKeyFormat property is set to V1, then this gets set to PBEWithMD5AndDES, otherwise it gets set to PBEWithSHA1AndDESede.
Type
PbeAlgorithm: One of auto, PBEWithMD5AndDES, PBEWithMD5AndTripleDES, PBEWithSHA1AndDESede, PBEWithSHA1AndRC2_40, PBEWithSHA1AndRC2_128, PBEWithSHA1AndRC4_40, PBEWithSHA1AndRC4_128, PBEWithHmacSHA1AndAES_128, PBEWithHmacSHA224AndAES_128, PBEWithHmacSHA256AndAES_128, PBEWithHmacSHA384AndAES_128, PBEWithHmacSHA512AndAES_128, PBEWithHmacSHA1AndAES_256, PBEWithHmacSHA224AndAES_256, PBEWithHmacSHA256AndAES_256, PBEWithHmacSHA384AndAES_256 or PBEWithHmacSHA512AndAES_256.
Default
auto
Description
The type of the preferences nodes where to install license keys. Note that the value system generally requires the JVM to be run with administrator privileges or otherwise a java.util.prefs.BackingStoreException may get thrown by the generated integration tests.
Type
PreferencesType: One of system or user.
Default
user
Description
The path of the private key store file in the Key Generator module relative to the base path ${artifactId}-keygen/src/main/resources/ .
Type
token
Default
private.ks
Description
The path of the public key store file in the Key Manager module relative to the base path ${artifactId}-keymgr/src/main/resources/ .
Type
token
Default
public.ks
Description
The algorithm to use when signing a generated key pair in a key store file at the first build. This property is ignored if the key store file already exists. Otherwise, if the value is set to auto, then the default value of the keytool is used. Otherwise, the signature algorithm needs to match the configured ${keyPairAlgorithm} and be supported by one of the security providers which are installed in the JRE/JDK.
Type
SignatureAlgorithm: One of auto, NONEwithDSA, SHA1withDSA, SHA224withDSA, SHA256withDSA, NONEwithECDSA, SHA1withECDSA, SHA224withECDSA, SHA256withECDSA, SHA384withECDSA, SHA512withECDSA, NONEwithRSA, MD2withRSA, MD5withRSA, SHA1withRSA, SHA224withRSA, SHA256withRSA, SHA384withRSA or SHA512withRSA.
Default
auto
Description
The TrueLicense version to depend upon.
Type
token
Default
3.2.0
Description
Whether or not the CLI should write debugging information to the standard error stream by default.
Type
boolean
Default
false