or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

Files

docs

artifact-management.mdindex.mdlegacy-repository-system.mdmetadata-processing.mdprofile-management.mdproject-building.mdrepository-operations.mdruntime-information.md

artifact-management.mddocs/

0

# Artifact Management

1

2

Core artifact management functionality including scoping, status tracking, and repository layout support for Maven2 compatibility.

3

4

## Capabilities

5

6

### ArtifactScopeEnum

7

8

Type-safe enumeration for Maven artifact scopes with scope relationship logic.

9

10

```java { .api }

11

/**

12

* Type safe reincarnation of Artifact scope with scope relationship logic

13

*/

14

public enum ArtifactScopeEnum {

15

compile(1),

16

test(2),

17

runtime(3),

18

provided(4),

19

system(5),

20

runtime_plus_system(6);

21

22

/**

23

* Default scope constant

24

*/

25

public static final ArtifactScopeEnum DEFAULT_SCOPE = compile;

26

27

/**

28

* Gets the string representation of the scope

29

* @return scope name as string

30

*/

31

public String getScope();

32

33

/**

34

* Determines if this scope encloses (includes) another scope

35

* @param scope the scope to check

36

* @return true if this scope includes the given scope

37

*/

38

public boolean encloses(ArtifactScopeEnum scope);

39

40

/**

41

* Validates and returns the scope, or DEFAULT_SCOPE if null

42

* @param scope scope to check

43

* @return validated scope or DEFAULT_SCOPE

44

*/

45

public static ArtifactScopeEnum checkScope(ArtifactScopeEnum scope);

46

}

47

```

48

49

**Usage Examples:**

50

51

```java

52

import org.apache.maven.artifact.ArtifactScopeEnum;

53

54

// Use compile scope (default)

55

ArtifactScopeEnum compileScope = ArtifactScopeEnum.compile;

56

ArtifactScopeEnum defaultScope = ArtifactScopeEnum.DEFAULT_SCOPE;

57

58

// Check scope relationships

59

boolean includesTest = compileScope.encloses(ArtifactScopeEnum.test);

60

boolean includesRuntime = compileScope.encloses(ArtifactScopeEnum.runtime);

61

62

// Validate scope

63

ArtifactScopeEnum validatedScope = ArtifactScopeEnum.checkScope(someScope);

64

65

// Get scope name

66

String scopeName = compileScope.getScope(); // "compile"

67

```

68

69

### ArtifactStatus

70

71

Type-safe enumeration for artifact trust/validation status with comparison support.

72

73

```java { .api }

74

/**

75

* Type-safe enumeration for artifact trust/validation status

76

*/

77

public final class ArtifactStatus implements Comparable<ArtifactStatus> {

78

/**

79

* Status constants in order of trust level

80

*/

81

public static final ArtifactStatus NONE = new ArtifactStatus("none", 0);

82

public static final ArtifactStatus GENERATED = new ArtifactStatus("generated", 1);

83

public static final ArtifactStatus CONVERTED = new ArtifactStatus("converted", 2);

84

public static final ArtifactStatus PARTNER = new ArtifactStatus("partner", 3);

85

public static final ArtifactStatus DEPLOYED = new ArtifactStatus("deployed", 4);

86

public static final ArtifactStatus VERIFIED = new ArtifactStatus("verified", 5);

87

88

/**

89

* Creates ArtifactStatus from string representation

90

* @param status status name

91

* @return corresponding ArtifactStatus instance

92

*/

93

public static ArtifactStatus valueOf(String status);

94

95

/**

96

* Compares this status with another based on trust level

97

* @param s status to compare with

98

* @return negative, zero, or positive integer for less than, equal, or greater than

99

*/

100

public int compareTo(ArtifactStatus s);

101

}

102

```

103

104

**Usage Examples:**

105

106

```java

107

import org.apache.maven.artifact.ArtifactStatus;

108

109

// Create status instances

110

ArtifactStatus deployedStatus = ArtifactStatus.valueOf("DEPLOYED");

111

ArtifactStatus verifiedStatus = ArtifactStatus.VERIFIED;

112

113

// Compare status levels

114

int comparison = deployedStatus.compareTo(verifiedStatus); // negative (deployed < verified)

115

boolean isVerifiedBetter = verifiedStatus.compareTo(deployedStatus) > 0; // true

116

117

// Use in collections

118

List<ArtifactStatus> statuses = Arrays.asList(

119

ArtifactStatus.NONE,

120

ArtifactStatus.VERIFIED,

121

ArtifactStatus.DEPLOYED

122

);

123

Collections.sort(statuses); // Sorts by trust level

124

```

125

126

127

## Integration Patterns

128

129

### Scope Hierarchy Usage

130

131

```java

132

// Check if artifacts from one scope should be included in another

133

public boolean shouldIncludeArtifact(ArtifactScopeEnum targetScope, ArtifactScopeEnum artifactScope) {

134

return targetScope.encloses(artifactScope);

135

}

136

137

// Example: Runtime classpath includes compile and runtime artifacts

138

ArtifactScopeEnum runtimeScope = ArtifactScopeEnum.runtime;

139

boolean includeCompile = runtimeScope.encloses(ArtifactScopeEnum.compile); // true

140

boolean includeTest = runtimeScope.encloses(ArtifactScopeEnum.test); // false

141

```

142

143

### Status-Based Filtering

144

145

```java

146

// Filter artifacts by minimum trust level

147

public List<Artifact> filterByMinimumStatus(List<Artifact> artifacts, ArtifactStatus minStatus) {

148

return artifacts.stream()

149

.filter(artifact -> artifact.getStatus().compareTo(minStatus) >= 0)

150

.collect(Collectors.toList());

151

}

152

153

// Example: Only include deployed or verified artifacts

154

List<Artifact> trustedArtifacts = filterByMinimumStatus(allArtifacts, ArtifactStatus.DEPLOYED);

155

```