or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

build-config.mdcore-model.mddependencies.mdindex.mdmodel-merging.mdprofiles.mdproject-metadata.mdrepositories.mdutility-classes.mdxml-io.md

profiles.mddocs/

0

# Profile System

1

2

Profile definitions, activation conditions, and profile-specific build configuration. Profiles enable conditional build behavior based on environment properties, operating system, file presence, or explicit activation.

3

4

## Capabilities

5

6

### Profile

7

8

Represents a build profile that can conditionally modify the build based on activation criteria.

9

10

```java { .api }

11

public class Profile extends ModelBase {

12

public String getId();

13

public void setId(String id);

14

public Activation getActivation();

15

public void setActivation(Activation activation);

16

public Build getBuild();

17

public void setBuild(Build build);

18

19

// Utility methods

20

public String toString();

21

public Profile clone();

22

public InputLocation getLocation(Object key);

23

public void setLocation(Object key, InputLocation location);

24

}

25

```

26

27

**Usage Example:**

28

29

```java

30

Profile profile = new Profile();

31

profile.setId("development");

32

33

// Set up activation based on property

34

Activation activation = new Activation();

35

ActivationProperty property = new ActivationProperty();

36

property.setName("env");

37

property.setValue("dev");

38

activation.setProperty(property);

39

profile.setActivation(activation);

40

41

// Add profile-specific build configuration

42

Build build = new Build();

43

build.setFinalName("myapp-dev");

44

profile.setBuild(build);

45

46

model.addProfile(profile);

47

```

48

49

### Activation

50

51

Defines the conditions under which a profile should be activated.

52

53

```java { .api }

54

public class Activation {

55

public boolean isActiveByDefault();

56

public String getActiveByDefault();

57

public void setActiveByDefault(String activeByDefault);

58

public String getJdk();

59

public void setJdk(String jdk);

60

public ActivationOS getOs();

61

public void setOs(ActivationOS os);

62

public ActivationProperty getProperty();

63

public void setProperty(ActivationProperty property);

64

public ActivationFile getFile();

65

public void setFile(ActivationFile file);

66

67

// Utility methods

68

public Activation clone();

69

public InputLocation getLocation(Object key);

70

public void setLocation(Object key, InputLocation location);

71

}

72

```

73

74

### ActivationProperty

75

76

Activates a profile based on the presence or value of a system property.

77

78

```java { .api }

79

public class ActivationProperty {

80

public String getName();

81

public void setName(String name);

82

public String getValue();

83

public void setValue(String value);

84

85

// Utility methods

86

public ActivationProperty clone();

87

public InputLocation getLocation(Object key);

88

public void setLocation(Object key, InputLocation location);

89

}

90

```

91

92

**Property Activation Examples:**

93

94

```java

95

// Activate when property is present (any value)

96

ActivationProperty prop1 = new ActivationProperty();

97

prop1.setName("debug");

98

99

// Activate when property has specific value

100

ActivationProperty prop2 = new ActivationProperty();

101

prop2.setName("environment");

102

prop2.setValue("production");

103

104

// Activate when property is NOT present

105

ActivationProperty prop3 = new ActivationProperty();

106

prop3.setName("!skipTests");

107

```

108

109

### ActivationOS

110

111

Activates a profile based on operating system characteristics.

112

113

```java { .api }

114

public class ActivationOS {

115

public String getName();

116

public void setName(String name);

117

public String getFamily();

118

public void setFamily(String family);

119

public String getArch();

120

public void setArch(String arch);

121

public String getVersion();

122

public void setVersion(String version);

123

124

// Utility methods

125

public ActivationOS clone();

126

public InputLocation getLocation(Object key);

127

public void setLocation(Object key, InputLocation location);

128

}

129

```

130

131

**Usage Example:**

132

133

```java

134

ActivationOS os = new ActivationOS();

135

os.setFamily("windows");

136

os.setArch("x86_64");

137

138

Activation activation = new Activation();

139

activation.setOs(os);

140

```

141

142

**Common OS Families:**

143

- `windows`

144

- `unix`

145

- `mac`

146

147

### ActivationFile

148

149

Activates a profile based on the presence or absence of files.

150

151

```java { .api }

152

public class ActivationFile {

153

public String getMissing();

154

public void setMissing(String missing);

155

public String getExists();

156

public void setExists(String exists);

157

158

// Utility methods

159

public ActivationFile clone();

160

public InputLocation getLocation(Object key);

161

public void setLocation(Object key, InputLocation location);

162

}

163

```

164

165

**Usage Example:**

166

167

```java

168

// Activate when file exists

169

ActivationFile file1 = new ActivationFile();

170

file1.setExists("src/main/config/local.properties");

171

172

// Activate when file is missing

173

ActivationFile file2 = new ActivationFile();

174

file2.setMissing("src/main/config/production.properties");

175

176

Activation activation = new Activation();

177

activation.setFile(file1);

178

```

179

180

## Profile Activation Methods

181

182

### Command Line Activation

183

184

Profiles can be activated from the command line:

185

186

```bash

187

# Activate specific profiles

188

mvn compile -P profile1,profile2

189

190

# Deactivate specific profiles

191

mvn compile -P !profile1

192

193

# Activate and deactivate profiles

194

mvn compile -P profile1,!profile2

195

```

196

197

### Automatic Activation

198

199

Profiles are automatically activated when their activation conditions are met:

200

201

```java

202

// Always active

203

Activation activation = new Activation();

204

activation.setActiveByDefault("true");

205

206

// JDK version based

207

activation.setJdk("11"); // Exact version

208

activation.setJdk("[1.8,)"); // Version range

209

activation.setJdk("!1.7"); // Exclude version

210

```

211

212

### Environment-Based Activation

213

214

```java

215

// Property-based activation

216

ActivationProperty prop = new ActivationProperty();

217

prop.setName("maven.test.skip");

218

prop.setValue("true");

219

220

// OS-based activation

221

ActivationOS os = new ActivationOS();

222

os.setFamily("unix");

223

224

// File-based activation

225

ActivationFile file = new ActivationFile();

226

file.setExists("deployment.properties");

227

```