43
43
import org .eclipse .aether .collection .CollectRequest ;
44
44
import org .eclipse .aether .connector .basic .BasicRepositoryConnectorFactory ;
45
45
import org .eclipse .aether .graph .Dependency ;
46
- import org .eclipse .aether .impl .DefaultServiceLocator ;
47
46
import org .eclipse .aether .repository .LocalRepository ;
48
47
import org .eclipse .aether .repository .RemoteRepository ;
49
48
import org .eclipse .aether .resolution .ArtifactResult ;
@@ -240,11 +239,9 @@ private static List<URL> getAdditionalUrls(List<MergedAnnotations> annotations)
240
239
241
240
private static List <URL > resolveCoordinates (String [] coordinates ) {
242
241
Exception latestFailure = null ;
243
- DefaultServiceLocator serviceLocator = MavenRepositorySystemUtils .newServiceLocator ();
244
- serviceLocator .addService (RepositoryConnectorFactory .class , BasicRepositoryConnectorFactory .class );
245
- serviceLocator .addService (TransporterFactory .class , HttpTransporterFactory .class );
246
- RepositorySystem repositorySystem = serviceLocator .getService (RepositorySystem .class );
242
+ RepositorySystem repositorySystem = createRepositorySystem ();
247
243
DefaultRepositorySystemSession session = MavenRepositorySystemUtils .newSession ();
244
+ session .setSystemProperties (System .getProperties ());
248
245
LocalRepository localRepository = new LocalRepository (System .getProperty ("user.home" ) + "/.m2/repository" );
249
246
RemoteRepository remoteRepository = new RemoteRepository .Builder ("central" , "default" ,
250
247
"https://repo.maven.apache.org/maven2" )
@@ -270,6 +267,15 @@ private static List<URL> resolveCoordinates(String[] coordinates) {
270
267
latestFailure );
271
268
}
272
269
270
+ @ SuppressWarnings ("deprecation" )
271
+ private static RepositorySystem createRepositorySystem () {
272
+ org .eclipse .aether .impl .DefaultServiceLocator serviceLocator = MavenRepositorySystemUtils .newServiceLocator ();
273
+ serviceLocator .addService (RepositoryConnectorFactory .class , BasicRepositoryConnectorFactory .class );
274
+ serviceLocator .addService (TransporterFactory .class , HttpTransporterFactory .class );
275
+ RepositorySystem repositorySystem = serviceLocator .getService (RepositorySystem .class );
276
+ return repositorySystem ;
277
+ }
278
+
273
279
private static List <Dependency > createDependencies (String [] allCoordinates ) {
274
280
List <Dependency > dependencies = new ArrayList <>();
275
281
for (String coordinate : allCoordinates ) {
0 commit comments