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 ;
@@ -232,11 +231,9 @@ private static List<URL> getAdditionalUrls(List<MergedAnnotations> annotations)
232
231
233
232
private static List <URL > resolveCoordinates (String [] coordinates ) {
234
233
Exception latestFailure = null ;
235
- DefaultServiceLocator serviceLocator = MavenRepositorySystemUtils .newServiceLocator ();
236
- serviceLocator .addService (RepositoryConnectorFactory .class , BasicRepositoryConnectorFactory .class );
237
- serviceLocator .addService (TransporterFactory .class , HttpTransporterFactory .class );
238
- RepositorySystem repositorySystem = serviceLocator .getService (RepositorySystem .class );
234
+ RepositorySystem repositorySystem = createRepositorySystem ();
239
235
DefaultRepositorySystemSession session = MavenRepositorySystemUtils .newSession ();
236
+ session .setSystemProperties (System .getProperties ());
240
237
LocalRepository localRepository = new LocalRepository (System .getProperty ("user.home" ) + "/.m2/repository" );
241
238
RemoteRepository remoteRepository = new RemoteRepository .Builder ("central" , "default" ,
242
239
"https://repo.maven.apache.org/maven2" )
@@ -262,6 +259,15 @@ private static List<URL> resolveCoordinates(String[] coordinates) {
262
259
latestFailure );
263
260
}
264
261
262
+ @ SuppressWarnings ("deprecation" )
263
+ private static RepositorySystem createRepositorySystem () {
264
+ org .eclipse .aether .impl .DefaultServiceLocator serviceLocator = MavenRepositorySystemUtils .newServiceLocator ();
265
+ serviceLocator .addService (RepositoryConnectorFactory .class , BasicRepositoryConnectorFactory .class );
266
+ serviceLocator .addService (TransporterFactory .class , HttpTransporterFactory .class );
267
+ RepositorySystem repositorySystem = serviceLocator .getService (RepositorySystem .class );
268
+ return repositorySystem ;
269
+ }
270
+
265
271
private static List <Dependency > createDependencies (String [] allCoordinates ) {
266
272
List <Dependency > dependencies = new ArrayList <>();
267
273
for (String coordinate : allCoordinates ) {
0 commit comments