Skip to content

Commit 71254ab

Browse files
committed
docs
1 parent f2c9db3 commit 71254ab

File tree

2 files changed

+44
-10
lines changed

2 files changed

+44
-10
lines changed

classpath-replacer-core/src/main/java/com/freemanan/cr/core/anno/Action.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,18 @@
1414
@Target(ElementType.TYPE)
1515
public @interface Action {
1616

17+
/**
18+
* The values associated with the {@link #verb}.
19+
*
20+
* @return value
21+
*/
1722
String[] value();
1823

24+
/**
25+
* The verb of the action.
26+
*
27+
* @return {@link Verb}
28+
* @see Verb
29+
*/
1930
Verb verb() default Verb.ADD;
2031
}

classpath-replacer-core/src/main/java/com/freemanan/cr/core/anno/ClasspathReplacer.java

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,42 @@
1313
* <p>
1414
* This operation is performed in order, so if there are multiple operations, you need to pay attention to the order.
1515
*
16-
* <p>
17-
* For example:
16+
* <p> Examples:
17+
*
18+
* <p> Exclude the {@code slf4j-log4j12} first then add the {@code logback-classic} jar:
1819
* <pre>{@code
19-
* ClasspathReplacer({
20-
* @Action(action = EXCLUDE, value = "slf4j-log4j12-*.jar"),
21-
* @Action(action = ADD, value = "ch.qos.logback:logback-classic:1.4.5")
22-
* })
23-
* class SomeTest {}
20+
* @ClasspathReplacer(
21+
* value = {
22+
* @Action(verb = EXCLUDE, value = "slf4j-log4j12-*.jar"),
23+
* @Action(verb = ADD, value = "ch.qos.logback:logback-classic:1.4.5")
24+
* }
25+
* )
2426
* }</pre>
25-
* <p> This will exclude the {@code slf4j-log4j12} first then add the {@code logback-classic} jar.
2627
*
27-
* <p>
28-
* When add new dependencies, there may be dependency conflicts. For example, the log framework used by the current program is {@code logback}, and the added dependency using {@code log4j}.
28+
* <p> Exclude the {@code spring-boot-starter-web} and all its sub-dependencies:
29+
* <pre>{@code
30+
* @ClasspathReplacer(
31+
* value = {
32+
* @Action(verb = EXCLUDE, value = "org.springframework.boot:spring-boot-starter-web")
33+
* },
34+
* recursiveExclude = true
35+
* )
36+
* }</pre>
37+
*
38+
* <p> Configure the extra repositories or proxy repository to use when resolving dependencies:
39+
* <pre>{@code
40+
* @ClasspathReplacer(
41+
* value = {
42+
* @Action(verb = ADD, value = "com.youcompany:your-dependency:1.0.0")
43+
* },
44+
* repositories = {
45+
* @Repository(value = "https://maven.youcompany.com/repository/release/", username = "admin", password = "${MAVEN_PASSWORD}"),
46+
* @Repository("https://maven.aliyun.com/repository/public/")
47+
* }
48+
* )
49+
* }</pre>
50+
*
51+
* <p> When add new dependencies, there may be dependency conflicts. For example, the log framework used by the current program is {@code logback}, and the added dependency using {@code log4j}.
2952
* Therefore, in complex scenarios, the ability to define the order of actions is a very important feature.
3053
*
3154
* @author Freeman

0 commit comments

Comments
 (0)