88 * Last Modified : <2025-07-14>
99 * ------------------------------------------------------------*/
1010
11+ #include "rawstr4c.h"
12+
1113static SourceProvider_t pl_java_upstream =
1214{
1315 def_upstream , "https://mvnrepository.com/" ,
@@ -74,14 +76,9 @@ pl_java_setsrc (char *option)
7476
7577 if (maven_exist )
7678 {
77- const char * file = xy_strjoin (7 ,
78- "<mirror>\n"
79- " <id>" , source .mirror -> code , "</id>\n"
80- " <mirrorOf>*</mirrorOf>\n"
81- " <name>" , source .mirror -> name , "</name>\n"
82- " <url>" , source .url , "</url>\n"
83- "</mirror>" );
84-
79+ char * file = xy_str_gsub (RAWSTR_pl_maven_config , "@1@" , source .mirror -> code );
80+ file = xy_str_gsub (file , "@name@" , source .mirror -> name );
81+ file = xy_str_gsub (file , "@url@" , source .url );
8582 char * maven_config = pl_java_find_maven_config ();
8683 chsrc_note2 (xy_strjoin (3 , "请在 maven 配置文件 " , maven_config , " 中添加:" ));
8784 println (file );
@@ -90,17 +87,9 @@ pl_java_setsrc (char *option)
9087 if (gradle_exist )
9188 {
9289 if (maven_exist ) br ();
93- const char * file = xy_strjoin (3 ,
94- "allprojects {\n"
95- " repositories {\n"
96- " maven { url '" , source .url , "' }\n"
97- " mavenLocal()\n"
98- " mavenCentral()\n"
99- " }\n"
100- "}" );
101-
90+ char * file = xy_str_gsub (RAWSTR_pl_build_gradle , "@url@" , source .url );
10291 chsrc_note2 ("请在 build.gradle 中添加:" );
103- p (file );
92+ println (file );
10493 }
10594
10695 chsrc_determine_chgtype (ChgType_Manual );
0 commit comments