Skip to content
Closed
2 changes: 1 addition & 1 deletion maven-resolver-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver</artifactId>
<version>1.8.2-SNAPSHOT</version>
<version>1.8.3-SNAPSHOT</version>
</parent>

<artifactId>maven-resolver-api</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-resolver-connector-basic/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver</artifactId>
<version>1.8.2-SNAPSHOT</version>
<version>1.8.3-SNAPSHOT</version>
</parent>

<artifactId>maven-resolver-connector-basic</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-demos</artifactId>
<version>1.8.2-SNAPSHOT</version>
<version>1.8.3-SNAPSHOT</version>
</parent>

<artifactId>resolver-demo-maven-plugin</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-resolver-demos/maven-resolver-demo-snippets/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-demos</artifactId>
<version>1.8.2-SNAPSHOT</version>
<version>1.8.3-SNAPSHOT</version>
</parent>

<artifactId>maven-resolver-demo-snippets</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-resolver-demos/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver</artifactId>
<version>1.8.2-SNAPSHOT</version>
<version>1.8.3-SNAPSHOT</version>
</parent>

<artifactId>maven-resolver-demos</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-resolver-impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver</artifactId>
<version>1.8.2-SNAPSHOT</version>
<version>1.8.3-SNAPSHOT</version>
</parent>

<artifactId>maven-resolver-impl</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ public RepositoryLayout newInstance( RepositorySystemSession session, RemoteRepo
}

return new Maven2RepositoryLayout(
new ArrayList<>( checksumAlgorithmFactorySelector.getChecksumAlgorithmFactories() ),
checksumsAlgorithms,
omitChecksumsForExtensions
);
Expand All @@ -150,15 +151,18 @@ public RepositoryLayout newInstance( RepositorySystemSession session, RemoteRepo
private static class Maven2RepositoryLayout
implements RepositoryLayout
{
private final List<ChecksumAlgorithmFactory> allChecksumAlgorithms;

private final List<ChecksumAlgorithmFactory> checksumAlgorithms;
private final List<ChecksumAlgorithmFactory> configuredChecksumAlgorithms;

private final Set<String> extensionsWithoutChecksums;

private Maven2RepositoryLayout( List<ChecksumAlgorithmFactory> checksumAlgorithms,
private Maven2RepositoryLayout( List<ChecksumAlgorithmFactory> allChecksumAlgorithms,
List<ChecksumAlgorithmFactory> configuredChecksumAlgorithms,
Set<String> extensionsWithoutChecksums )
{
this.checksumAlgorithms = Collections.unmodifiableList( checksumAlgorithms );
this.allChecksumAlgorithms = Collections.unmodifiableList( allChecksumAlgorithms );
this.configuredChecksumAlgorithms = Collections.unmodifiableList( configuredChecksumAlgorithms );
this.extensionsWithoutChecksums = requireNonNull( extensionsWithoutChecksums );
}

Expand All @@ -177,7 +181,7 @@ private URI toUri( String path )
@Override
public List<ChecksumAlgorithmFactory> getChecksumAlgorithmFactories()
{
return checksumAlgorithms;
return configuredChecksumAlgorithms;
}

@Override
Expand Down Expand Up @@ -263,8 +267,8 @@ public List<ChecksumLocation> getChecksumLocations( Metadata metadata, boolean u

private List<ChecksumLocation> getChecksumLocations( URI location )
{
List<ChecksumLocation> checksumLocations = new ArrayList<>( checksumAlgorithms.size() );
for ( ChecksumAlgorithmFactory checksumAlgorithmFactory : checksumAlgorithms )
List<ChecksumLocation> checksumLocations = new ArrayList<>( configuredChecksumAlgorithms.size() );
for ( ChecksumAlgorithmFactory checksumAlgorithmFactory : configuredChecksumAlgorithms )
{
checksumLocations.add( ChecksumLocation.forLocation( location, checksumAlgorithmFactory ) );
}
Expand All @@ -273,7 +277,7 @@ private List<ChecksumLocation> getChecksumLocations( URI location )

private boolean isChecksum( String extension )
{
return checksumAlgorithms.stream().anyMatch( a -> extension.endsWith( "." + a.getFileExtension() ) );
return allChecksumAlgorithms.stream().anyMatch( a -> extension.endsWith( "." + a.getFileExtension() ) );
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,17 @@ public void testCustomChecksumsIgnored()
assertEquals( 0, checksums.size() );
}

@Test
public void testNotConfiguredButSupportedChecksumsHandledAsChecksums()
throws Exception
{
layout = factory.newInstance( session, newRepo( "default" ) );
DefaultArtifact artifact = new DefaultArtifact( "g.i.d", "a-i.d", "cls", "jar.sha512", "1.0" );
URI uri = layout.getLocation( artifact, true );
List<ChecksumLocation> checksums = layout.getChecksumLocations( artifact, true, uri );
assertEquals( 0, checksums.size() );
}

@Test
public void testCustomChecksumsIgnored_IllegalInout()
throws Exception
Expand Down
2 changes: 1 addition & 1 deletion maven-resolver-named-locks-hazelcast/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver</artifactId>
<version>1.8.2-SNAPSHOT</version>
<version>1.8.3-SNAPSHOT</version>
</parent>

<artifactId>maven-resolver-named-locks-hazelcast</artifactId>
Expand Down
14 changes: 12 additions & 2 deletions maven-resolver-named-locks-redisson/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver</artifactId>
<version>1.8.2-SNAPSHOT</version>
<version>1.8.3-SNAPSHOT</version>
</parent>

<artifactId>maven-resolver-named-locks-redisson</artifactId>
Expand All @@ -38,6 +38,8 @@
<properties>
<Automatic-Module-Name>org.apache.maven.resolver.named.redisson</Automatic-Module-Name>
<Bundle-SymbolicName>${Automatic-Module-Name}</Bundle-SymbolicName>
<!-- Used in site also -->
<redissonVersion>3.17.5</redissonVersion>
</properties>

<dependencies>
Expand All @@ -52,7 +54,7 @@
<dependency>
<groupId>org.redisson</groupId>
<artifactId>redisson</artifactId>
<version>3.15.6</version>
<version>${redissonVersion}</version>
<exclusions>
<exclusion>
<groupId>javax.cache</groupId>
Expand All @@ -74,6 +76,14 @@
<groupId>io.reactivex.rxjava3</groupId>
<artifactId>rxjava</artifactId>
</exclusion>
<exclusion>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-unix-common</artifactId>
</exclusion>
<exclusion>
<groupId>org.reactivestreams</groupId>
<artifactId>reactive-streams</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
Expand Down
37 changes: 21 additions & 16 deletions maven-resolver-named-locks-redisson/src/site/markdown/index.md.vm
Original file line number Diff line number Diff line change
Expand Up @@ -46,27 +46,32 @@ To use this implementation within your project, depending on how you integrate,

${esc.hash}${esc.hash} Installation/Testing

#set( $jacksonVersion = "2.13.3" )
#set( $jbossMarshallingVersion = "2.0.11.Final" )
#set( $nettyVersion = "4.1.79.Final" )
#set( $snakeyamlVersion = "1.30" )

- Create the directory `${maven.home}/lib/ext/redisson/`.
- Modify `${maven.home}/bin/m2.conf` by adding `load ${maven.home}/lib/ext/redisson/*.jar`
right after the `${maven.conf}/logging` line.
- Copy the following dependencies from Maven Central to `${maven.home}/lib/ext/redisson/`:
<pre class="source">
├── <a href="https://repo1.maven.org/maven2/org/apache/maven/resolver/${project.artifactId}/${project.version}/${project.artifactId}-${project.version}.jar">${project.artifactId}-${project.version}.jar</a>
├── <a href="https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/2.12.1/jackson-annotations-2.12.1.jar">jackson-annotations-2.12.1.jar</a>
├── <a href="https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/2.12.1/jackson-core-2.12.1.jar">jackson-core-2.12.1.jar</a>
├── <a href="https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/2.12.1/jackson-databind-2.12.1.jar">jackson-databind-2.12.1.jar</a>
├── <a href="https://repo1.maven.org/maven2/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/2.12.1/jackson-dataformat-yaml-2.12.1.jar">jackson-dataformat-yaml-2.12.1.jar</a>
├── <a href="https://repo1.maven.org/maven2/org/jboss/marshalling/jboss-marshalling/2.0.11.Final/jboss-marshalling-2.0.11.Final.jar">jboss-marshalling-2.0.11.Final.jar</a>
├── <a href="https://repo1.maven.org/maven2/org/jboss/marshalling/jboss-marshalling-river/2.0.11.Final/jboss-marshalling-river-2.0.11.Final.jar">jboss-marshalling-river-2.0.11.Final.jar</a>
├── <a href="https://repo1.maven.org/maven2/io/netty/netty-buffer/4.1.65.Final/netty-buffer-4.1.65.Final.jar">netty-buffer-4.1.65.Final.jar</a>
├── <a href="https://repo1.maven.org/maven2/io/netty/netty-codec/4.1.65.Final/netty-codec-4.1.65.Final.jar">netty-codec-4.1.65.Final.jar</a>
├── <a href="https://repo1.maven.org/maven2/io/netty/netty-codec-dns/4.1.65.Final/netty-codec-dns-4.1.65.Final.jar">netty-codec-dns-4.1.65.Final.jar</a>
├── <a href="https://repo1.maven.org/maven2/io/netty/netty-common/4.1.65.Final/netty-common-4.1.65.Final.jar">netty-common-4.1.65.Final.jar</a>
├── <a href="https://repo1.maven.org/maven2/io/netty/netty-handler/4.1.65.Final/netty-handler-4.1.65.Final.jar">netty-handler-4.1.65.Final.jar</a>
├── <a href="https://repo1.maven.org/maven2/io/netty/netty-resolver/4.1.65.Final/netty-resolver-4.1.65.Final.jar">netty-resolver-4.1.65.Final.jar</a>
├── <a href="https://repo1.maven.org/maven2/io/netty/netty-resolver-dns/4.1.65.Final/netty-resolver-dns-4.1.65.Final.jar">netty-resolver-dns-4.1.65.Final.jar</a>
├── <a href="https://repo1.maven.org/maven2/io/netty/netty-transport/4.1.65.Final/netty-transport-4.1.65.Final.jar">netty-transport-4.1.65.Final.jar</a>
├── <a href="https://repo1.maven.org/maven2/org/redisson/redisson/3.15.6/redisson-3.15.6.jar">redisson-3.15.6.jar</a>
└── <a href="https://repo1.maven.org/maven2/org/yaml/snakeyaml/1.27/snakeyaml-1.27.jar">snakeyaml-1.27.jar</a></pre>
├── <a href="https://repo1.maven.org/maven2/org/redisson/redisson/${redissonVersion}/redisson-${redissonVersion}.jar">redisson-${redissonVersion}.jar</a>
├── <a href="https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-annotations/${jacksonVersion}/jackson-annotations-${jacksonVersion}.jar">jackson-annotations-${jacksonVersion}.jar</a>
├── <a href="https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-core/${jacksonVersion}/jackson-core-${jacksonVersion}.jar">jackson-core-${jacksonVersion}.jar</a>
├── <a href="https://repo1.maven.org/maven2/com/fasterxml/jackson/core/jackson-databind/${jacksonVersion}/jackson-databind-${jacksonVersion}.jar">jackson-databind-${jacksonVersion}.jar</a>
├── <a href="https://repo1.maven.org/maven2/com/fasterxml/jackson/dataformat/jackson-dataformat-yaml/${jacksonVersion}/jackson-dataformat-yaml-${jacksonVersion}.jar">jackson-dataformat-yaml-${jacksonVersion}.jar</a>
├── <a href="https://repo1.maven.org/maven2/org/jboss/marshalling/jboss-marshalling/${jbossMarshallingVersion}/jboss-marshalling-${jbossMarshallingVersion}.jar">jboss-marshalling-${jbossMarshallingVersion}.jar</a>
├── <a href="https://repo1.maven.org/maven2/org/jboss/marshalling/jboss-marshalling-river/${jbossMarshallingVersion}/jboss-marshalling-river-${jbossMarshallingVersion}.jar">jboss-marshalling-river-${jbossMarshallingVersion}.jar</a>
├── <a href="https://repo1.maven.org/maven2/io/netty/netty-buffer/${nettyVersion}/netty-buffer-${nettyVersion}.jar">netty-buffer-${nettyVersion}.jar</a>
├── <a href="https://repo1.maven.org/maven2/io/netty/netty-codec/${nettyVersion}/netty-codec-${nettyVersion}.jar">netty-codec-${nettyVersion}.jar</a>
├── <a href="https://repo1.maven.org/maven2/io/netty/netty-codec-dns/${nettyVersion}/netty-codec-dns-${nettyVersion}.jar">netty-codec-dns-${nettyVersion}.jar</a>
├── <a href="https://repo1.maven.org/maven2/io/netty/netty-common/${nettyVersion}/netty-common-${nettyVersion}.jar">netty-common-${nettyVersion}.jar</a>
├── <a href="https://repo1.maven.org/maven2/io/netty/netty-handler/${nettyVersion}/netty-handler-${nettyVersion}.jar">netty-handler-${nettyVersion}.jar</a>
├── <a href="https://repo1.maven.org/maven2/io/netty/netty-resolver/${nettyVersion}/netty-resolver-${nettyVersion}.jar">netty-resolver-${nettyVersion}.jar</a>
├── <a href="https://repo1.maven.org/maven2/io/netty/netty-resolver-dns/${nettyVersion}/netty-resolver-dns-${nettyVersion}.jar">netty-resolver-dns-${nettyVersion}.jar</a>
├── <a href="https://repo1.maven.org/maven2/io/netty/netty-transport/${nettyVersion}/netty-transport-${nettyVersion}.jar">netty-transport-${nettyVersion}.jar</a>
└── <a href="https://repo1.maven.org/maven2/org/yaml/snakeyaml/${snakeyamlVersion}/snakeyaml-${snakeyamlVersion}.jar">snakeyaml-${snakeyamlVersion}.jar</a></pre>
- Start your Redis instance on `localhost` or configure a remote instance with `${maven.conf}/maven-resolver-redisson.yaml`.
- Now start a multithreaded Maven build on your project.
2 changes: 1 addition & 1 deletion maven-resolver-named-locks/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver</artifactId>
<version>1.8.2-SNAPSHOT</version>
<version>1.8.3-SNAPSHOT</version>
</parent>

<artifactId>maven-resolver-named-locks</artifactId>
Expand Down
29 changes: 22 additions & 7 deletions maven-resolver-named-locks/src/site/markdown/index.md.vm
Original file line number Diff line number Diff line change
Expand Up @@ -23,28 +23,41 @@ Named locks are essentially locks that are assigned to some given (opaque) ID. I
resources that each can have unique ID assigned (i.e., file with an absolute path, some entities with unique ID),
then you can use named locks to make sure they are being protected from concurrent read and write actions.

Named locks provide support classes for implementations, and provide out of the box seven named lock implementations and three name mappers.
Named locks provide support classes for implementations, and provide out of the box several lock and name mapper implementations.

Out of the box, "local" (local to JVM) named lock implementations are the following:
Following implementations are "local" (local to JVM) named lock implementations:

- `rwlock-local` implemented in `org.eclipse.aether.named.providers.LocalReadWriteLockNamedLockFactory` that uses
JVM `java.util.concurrent.locks.ReentrantReadWriteLock`.
- `semaphore-local` implemented in `org.eclipse.aether.named.providers.LocalSemaphoreNamedLockFactory` that uses
JVM `java.util.concurrent.Semaphore`.
- `noop` implemented in `org.eclipse.aether.named.providers.NoopNamedLockFactory` that uses no locking.

Note about "local" locks: they are in-JVM, in a way, they properly coordinate in case of multithreaded access from
same JVM, but do not cover accesses across multiple processes and/or multiple hosts access.
In other words, local named locks are only suited within one JVM with a multithreaded access.

Following named lock implementations use underlying file system advisory file locking:

- `file-lock` implemented in `org.eclipse.aether.named.providers.FileLockNamedLockFactory` that uses
JVM `java.nio.channels.FileLock`.
- `noop` implemented in `org.eclipse.aether.named.providers.NoopNamedLockFactory` that uses no locking.

Out of the box, "distributed" named lock implementations are the following (separate modules which require additional dependencies):
The `file-lock` implementation uses file system advisory file locking, hence, concurrently running Maven processes
set up to use `file-lock` implementation can safely share one local repository. This is almost certain on
local file systems across all operating systems. In case of NFS mounts, file advisory locking MAY work if NFSv4+
used with complete setup (with all the necessary services like `RPC` and `portmapper` needed to implement NFS advisory
file locking, check your NFS and/or OS manuals for details). In short: if your (local or remote) FS correctly support
and implements advisory locking, it should work. Local FS usually does, while with NFS your mileage may vary.

Finally, "distributed" named lock implementations are the following (separate modules which require additional dependencies and remote services):

- `rwlock-redisson` implemented in `org.eclipse.aether.named.redisson.RedissonReadWriteLockNamedLockFactory`.
- `semaphore-redisson` implemented in `org.eclipse.aether.named.redisson.RedissonSemaphoreNamedLockFactory`.
- `semaphore-hazelcast-client` implemented in `org.eclipse.aether.named.hazelcast.HazelcastClientCPSemaphoreNamedLockFactory`.
- `semaphore-hazelcast` implemented in `org.eclipse.aether.named.hazelcast.HazelcastCPSemaphoreNamedLockFactory`.

Local named locks are only suited within one JVM with a multithreaded build.
Sharing a local repository between multiple Maven processes (i.e., on a busy CI server) requires a distributed named lock!

Sharing a local repository between multiple hosts (i.e., on a busy CI server) may be best done with one of distributed named lock,
if NFS locking is not working for you.

The aforementioned (opaque) IDs need to be mapped from artifacts and metadata.

Expand All @@ -54,3 +67,5 @@ Out of the box, name mapper implementations are the following:
- `gav` implemented in `org.eclipse.aether.internal.impl.synccontext.named.GAVNameMapper`.
- `discriminating` implemented in `org.eclipse.aether.internal.impl.synccontext.named.DiscriminatingNameMapper`.
- `file-gav` implemented in `org.eclipse.aether.internal.impl.synccontext.named.FileGAVNameMapper`.

Note: the `file-gav` name mapper MUST be used with `file-lock` named locking, no other mapper will work with it.
2 changes: 1 addition & 1 deletion maven-resolver-spi/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver</artifactId>
<version>1.8.2-SNAPSHOT</version>
<version>1.8.3-SNAPSHOT</version>
</parent>

<artifactId>maven-resolver-spi</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-resolver-test-util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver</artifactId>
<version>1.8.2-SNAPSHOT</version>
<version>1.8.3-SNAPSHOT</version>
</parent>

<artifactId>maven-resolver-test-util</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-resolver-transport-classpath/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver</artifactId>
<version>1.8.2-SNAPSHOT</version>
<version>1.8.3-SNAPSHOT</version>
</parent>

<artifactId>maven-resolver-transport-classpath</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-resolver-transport-file/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver</artifactId>
<version>1.8.2-SNAPSHOT</version>
<version>1.8.3-SNAPSHOT</version>
</parent>

<artifactId>maven-resolver-transport-file</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-resolver-transport-http/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver</artifactId>
<version>1.8.2-SNAPSHOT</version>
<version>1.8.3-SNAPSHOT</version>
</parent>

<artifactId>maven-resolver-transport-http</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-resolver-transport-wagon/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver</artifactId>
<version>1.8.2-SNAPSHOT</version>
<version>1.8.3-SNAPSHOT</version>
</parent>

<artifactId>maven-resolver-transport-wagon</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion maven-resolver-util/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<parent>
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver</artifactId>
<version>1.8.2-SNAPSHOT</version>
<version>1.8.3-SNAPSHOT</version>
</parent>

<artifactId>maven-resolver-util</artifactId>
Expand Down
Loading