-
Notifications
You must be signed in to change notification settings - Fork 127
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MRESOLVER-387] New RepositorySystem supplier (#319)
Added a new module that provides RepositorySystem supplier. To complete RepositorySystem instance, one needs some of Maven dependencies as well, hence the new module. The supplier provides non intrusive lightweight replacement for ServiceLocator. Changes: * new module with supplier * add new booter to demos using supplier (and make it default, instead of SL) * align Maven version used across "demo" and new module (fix demo guice module for that) * update javadoc of deprecated SL --- https://issues.apache.org/jira/browse/MRESOLVER-387
- Loading branch information
Showing
16 changed files
with
988 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
...ain/java/org/apache/maven/resolver/examples/supplier/SupplierRepositorySystemFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
package org.apache.maven.resolver.examples.supplier; | ||
|
||
import org.eclipse.aether.RepositorySystem; | ||
import org.eclipse.aether.supplier.RepositorySystemSupplier; | ||
|
||
/** | ||
* A factory for repository system instances that employs Maven Artifact Resolver's provided supplier. | ||
*/ | ||
public class SupplierRepositorySystemFactory { | ||
public static RepositorySystem newRepositorySystem() { | ||
return new RepositorySystemSupplier().get(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<!--- | ||
Licensed to the Apache Software Foundation (ASF) under one or more | ||
contributor license agreements. See the NOTICE file distributed with | ||
this work for additional information regarding copyright ownership. | ||
The ASF licenses this file to You under the Apache License, Version 2.0 | ||
(the "License"); you may not use this file except in compliance with | ||
the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
|
||
# Maven Resolver Supplier | ||
|
||
This simple module serves the purpose to "bootstrap" resolver when there is no desire to use | ||
[Eclipse Sisu](https://eclipse.dev/sisu/). It provides one simple class | ||
`org.eclipse.aether.supplier.RepositorySystemSupplier` that implements `Supplier<RepositorySystem>` | ||
and supplies ready-to-use `RepositorySystem` instances. | ||
|
||
The supplier class is written in such way, to allow easy customization if needed: just extend the class and override | ||
method one need (all methods are protected). | ||
|
||
Consumer/users of this module **must provide SLF4J backend**. Resolver uses `slf4j-api` for logging purposes, but this | ||
module does NOT provide any backend for it. It is the consumer/user obligation to provide one at runtime. | ||
|
||
Version of `maven-resolver-supplier` artifact used **must be strictly aligned** with other Resolver artifacts | ||
on classpath. | ||
|
||
By default, "full resolver experience" is provided: | ||
* for connector, the connector-basic is provided | ||
* for transport the two transport-file and transport-http implementations are provided. If Wagon is needed, add | ||
transport-wagon as dependency, and customize `RepositorySystemSupplier` to include it. This makes it available, but | ||
NOT used yet! To use it, you still need to configure resolver to favor Wagon over native HTTP. | ||
|
||
# Resolver configuration | ||
|
||
The supplier will provide only a "vanilla" instance. To configure resolver, use session user (or | ||
configuration) properties, when constructing session. All the configuration options are available as | ||
[listed here](https://maven.apache.org/resolver/configuration.html). | ||
|
||
# Extending Resolver | ||
|
||
Extending supplied resolver is simple, and basically requires same three steps for whatever extra you want to include | ||
(like Wagon transport, distributed locking, etc). | ||
|
||
First, you need to include needed module (with transitive deps) to your dependencies. | ||
|
||
Second, you need to customize `RepositorySystemSupplier` to make new components (`WagonTransporterFactory`, or | ||
distributed lock factories) available. | ||
|
||
Third, you need to configure session (via user of config properties) to make Resolver use newly added components. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Licensed to the Apache Software Foundation (ASF) under one | ||
or more contributor license agreements. See the NOTICE file | ||
distributed with this work for additional information | ||
regarding copyright ownership. The ASF licenses this file | ||
to you under the Apache License, Version 2.0 (the | ||
"License"); you may not use this file except in compliance | ||
with the License. You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, | ||
software distributed under the License is distributed on an | ||
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
KIND, either express or implied. See the License for the | ||
specific language governing permissions and limitations | ||
under the License. | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.apache.maven.resolver</groupId> | ||
<artifactId>maven-resolver</artifactId> | ||
<version>1.9.15-SNAPSHOT</version> | ||
</parent> | ||
|
||
<artifactId>maven-resolver-supplier</artifactId> | ||
|
||
<name>Maven Artifact Resolver Instance Supplier</name> | ||
<description>A helper module to provide RepositorySystem instances.</description> | ||
|
||
<properties> | ||
<Automatic-Module-Name>org.apache.maven.resolver.supplier</Automatic-Module-Name> | ||
<Bundle-SymbolicName>${Automatic-Module-Name}</Bundle-SymbolicName> | ||
</properties> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>org.apache.maven.resolver</groupId> | ||
<artifactId>maven-resolver-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven.resolver</groupId> | ||
<artifactId>maven-resolver-util</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven.resolver</groupId> | ||
<artifactId>maven-resolver-spi</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven.resolver</groupId> | ||
<artifactId>maven-resolver-named-locks</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven.resolver</groupId> | ||
<artifactId>maven-resolver-impl</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven.resolver</groupId> | ||
<artifactId>maven-resolver-connector-basic</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven.resolver</groupId> | ||
<artifactId>maven-resolver-transport-file</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven.resolver</groupId> | ||
<artifactId>maven-resolver-transport-http</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.apache.maven</groupId> | ||
<artifactId>maven-resolver-provider</artifactId> | ||
<version>${mavenVersion}</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>javax.inject</groupId> | ||
<artifactId>javax.inject</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.eclipse.sisu</groupId> | ||
<artifactId>org.eclipse.sisu.inject</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.maven</groupId> | ||
<artifactId>maven-model-builder</artifactId> | ||
<version>${mavenVersion}</version> | ||
<exclusions> | ||
<exclusion> | ||
<groupId>javax.inject</groupId> | ||
<artifactId>javax.inject</artifactId> | ||
</exclusion> | ||
<exclusion> | ||
<groupId>org.eclipse.sisu</groupId> | ||
<artifactId>org.eclipse.sisu.inject</artifactId> | ||
</exclusion> | ||
</exclusions> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-simple</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-core</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>biz.aQute.bnd</groupId> | ||
<artifactId>bnd-maven-plugin</artifactId> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<configuration> | ||
<archive> | ||
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> | ||
</archive> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
Oops, something went wrong.