Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-6869] New flag to verify Maven installation status #995

Open
wants to merge 44 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
44 commits
Select commit Hold shift click to select a range
904caa4
[MNG-6869] Initial idea
Giovds Dec 7, 2022
2dab934
[MNG-6869] Further brainstorming
mthmulders Dec 7, 2022
1082a0d
[MNG-6869] Refactor local variable name
Giovds Dec 7, 2022
8d46d92
[MNG-6969] WIP commit
Giovds Dec 22, 2022
9aaf62f
[MNG-6869] Correct way to find local repo path
mthmulders Dec 22, 2022
57c7020
[MNG-6869] Use java.nio instead of java.io
Giovds Dec 22, 2022
55f35fd
[MNG-6869] Use java.nio instead of java.io
mthmulders Dec 22, 2022
fdcce30
[MNG-6869] Implement verification of artifact resolution (WIP)
mthmulders Dec 22, 2022
e4ec517
[MNG-6869] Test artifact resolution with temporary local repository
mthmulders Jan 12, 2023
77526f5
[MNG-6869] Setup checks for remote connections
Giovds Jan 12, 2023
fbbcc20
[MNG-6869] Formatting
mthmulders Jan 12, 2023
ba9354a
[MNG-6869] Refactor: rename method
mthmulders Jan 12, 2023
85b0907
[MNG-6869] Formatting
mthmulders Jan 16, 2023
12a6b4b
[MNG-6869] Verify connection to remote repositories
mthmulders Jan 26, 2023
140a63c
[MNG-6869] Reformat with Spotless
mthmulders Jan 26, 2023
7afb18e
[MNG-6869] Add todo to fix local repository issue
Giovds Jan 26, 2023
ca4cb33
[MNG-6869] Narrow declaration of thrown exception
mthmulders Jan 26, 2023
0764fd0
[MNG-6869] Refine detection of possible connection issues
mthmulders Jan 26, 2023
30c9649
[MNG-6869] Use local repository correctly
Giovds Feb 9, 2023
d134358
[MNG-6869] Clean up temp file after usage
Giovds Feb 9, 2023
6ba97e6
[MNG-6869] Include local repository path in issue text
mthmulders Feb 9, 2023
79338ae
[MNG-6869] Mention local repo check has been completed
mthmulders Feb 9, 2023
b470aca
[MNG-6869] Output detected issues prefixed with a number
mthmulders Feb 9, 2023
8629a8a
[MNG-6869] Properly close streeam
mthmulders Feb 9, 2023
7fcc380
[MNG-6869] Make logger a static constant
mthmulders Feb 9, 2023
2b01442
[MNG-6869] Make it explicit we're populating instance variables
mthmulders Feb 9, 2023
95c52f2
[MNG-6869] Reorder instance variables
mthmulders Feb 9, 2023
d0f3b29
[MNG-6869] Mark method arguments as final
mthmulders Feb 9, 2023
58e2f46
[MNG-6869] Store temporary local repo as Path
mthmulders Feb 9, 2023
f67f7c3
[MNG-6869] Rename logger to LOGGER
mthmulders Feb 9, 2023
27a7e0a
[MNG-6869] Checkstyle: redundant modifier
mthmulders Feb 9, 2023
d2416a2
[MNG-6869] Minor review points
mthmulders Feb 9, 2023
2a9ce5e
[MNG-6869] Remove commented code
Giovds Feb 23, 2023
ed191ad
[MNG-6869] Use exception classification of Transporter
Giovds Feb 23, 2023
6adddbd
[MNG-6869] Make formatException signature non-optional
Giovds Feb 23, 2023
9443a2a
[MNG-6869] Remove unnecessary comment
Giovds Feb 23, 2023
41177b3
[MNG-6869] Remove unused DI fields
Giovds Feb 23, 2023
fc2e7f7
[MNG-6869] Make no assumptions about the existence of Maven Central
mthmulders Feb 23, 2023
2114cda
[MNG-6869] Simplify
mthmulders Feb 23, 2023
853819c
[MNG-6869] Prevent possible ClassCastException
mthmulders Feb 23, 2023
f39aec2
[MNG-6869] Revert unrelated change
mthmulders May 10, 2023
6c4348d
Merge branch 'master' into mng-6869-new-flag-to-verify-maven-status
Giovds Apr 26, 2024
eaf2421
[MNG-6869] Make it work with recent changes
Giovds Apr 26, 2024
63006df
[MNG-6869] Make use of try with resources
Giovds Apr 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
[MNG-6869] Reformat with Spotless
  • Loading branch information
mthmulders committed Feb 23, 2023
commit 140a63ccd43f067d53db2426d72e4e22d6272166
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 114,7 @@ public class CLIManager {

public static final String COLOR = "color";

public static final String INSTALLATION_STATUS = "status";
public static final String INSTALLATION_STATUS = "status";

/** This option is deprecated and may be repurposed as Java debug in a future version.
* Use {@code -X/--verbose} instead. */
Expand Down
71 changes: 30 additions & 41 deletions maven-embedder/src/main/java/org/apache/maven/cli/MavenCli.java
Original file line number Diff line number Diff line change
Expand Up @@ -405,25 405,20 @@ private void informativeCommands(CliRequest cliRequest) throws ExitException {
}
}

private void status( CliRequest cliRequest )
throws Exception
{
private void status(CliRequest cliRequest) throws Exception {
slf4jLoggerFactory = LoggerFactory.getILoggerFactory();
if ( cliRequest.commandLine.hasOption( CLIManager.INSTALLATION_STATUS ) )
{
MavenStatusCommand mavenStatusCommand = new MavenStatusCommand( plexusContainer );
final List<String> mavenStatusIssues = mavenStatusCommand.verify( cliRequest );
if ( !mavenStatusIssues.isEmpty() )
{
for ( String issue : mavenStatusIssues )
{
slf4jLogger.error( issue );
if (cliRequest.commandLine.hasOption(CLIManager.INSTALLATION_STATUS)) {
MavenStatusCommand mavenStatusCommand = new MavenStatusCommand(plexusContainer);
final List<String> mavenStatusIssues = mavenStatusCommand.verify(cliRequest);
if (!mavenStatusIssues.isEmpty()) {
for (String issue : mavenStatusIssues) {
slf4jLogger.error(issue);
}
throw new ExitException( 1 );
throw new ExitException(1);
}

slf4jLogger.info( "No installation issues found." );
throw new ExitException( 0 );
slf4jLogger.info("No installation issues found.");
throw new ExitException(0);
}
}

Expand Down Expand Up @@ -675,14 670,14 @@ protected void configure() {

dispatcher = (DefaultSecDispatcher) container.lookup(SecDispatcher.class, "maven");

defaultRepositorySystemSessionFactory = container.lookup( DefaultRepositorySystemSessionFactory.class );
defaultSessionFactory = container.lookup( DefaultSessionFactory.class );
mavenRepositorySystem = container.lookup( MavenRepositorySystem.class );
//
// private DefaultSessionFactory defaultSessionFactory;
//
// private MavenRepositorySystem mavenRepositorySystem;
// private DefaultRepositorySystemSessionFactory defaultRepositorySystemSessionFactory;
defaultRepositorySystemSessionFactory = container.lookup(DefaultRepositorySystemSessionFactory.class);
defaultSessionFactory = container.lookup(DefaultSessionFactory.class);
mavenRepositorySystem = container.lookup(MavenRepositorySystem.class);
//
// private DefaultSessionFactory defaultSessionFactory;
//
// private MavenRepositorySystem mavenRepositorySystem;
// private DefaultRepositorySystemSessionFactory defaultRepositorySystemSessionFactory;

plexusContainer = container;

Expand Down Expand Up @@ -896,7 891,8 @@ private void repository(CliRequest cliRequest) throws Exception {
}

private int execute(CliRequest cliRequest) throws MavenExecutionRequestPopulationException {
MavenExecutionRequest request = executionRequestPopulator.populateDefaults(cliRequest.request); // Populate request
MavenExecutionRequest request =
executionRequestPopulator.populateDefaults(cliRequest.request); // Populate request

if (cliRequest.request.getRepositoryCache() == null) {
cliRequest.request.setRepositoryCache(new DefaultRepositoryCache());
Expand Down Expand Up @@ -1278,24 1274,17 @@ private MavenExecutionRequest populateRequest(CliRequest cliRequest, MavenExecut

private String determineLocalRepositoryPath(final CliRequest cliRequest) {
final MavenExecutionRequest request = cliRequest.getRequest();
if ( cliRequest.commandLine.hasOption( CLIManager.INSTALLATION_STATUS ) )
{
try
{
return Files.createTempDirectory( "mvn-status" ).toAbsolutePath().toString();
}
catch ( IOException ioe )
{
final Logger logger = slf4jLoggerFactory.getLogger( getClass().getName() );
logger.debug( "Could not create temporary local repository", ioe );
logger.warn( "Artifact resolution test is less accurate as it may user earlier resolution results." );
if (cliRequest.commandLine.hasOption(CLIManager.INSTALLATION_STATUS)) {
try {
return Files.createTempDirectory("mvn-status").toAbsolutePath().toString();
} catch (IOException ioe) {
final Logger logger = slf4jLoggerFactory.getLogger(getClass().getName());
logger.debug("Could not create temporary local repository", ioe);
logger.warn("Artifact resolution test is less accurate as it may user earlier resolution results.");
}
}
else
{
String userDefinedLocalRepo = request.getUserProperties().getProperty( MavenCli.LOCAL_REPO_PROPERTY );
if ( userDefinedLocalRepo != null )
{
} else {
String userDefinedLocalRepo = request.getUserProperties().getProperty(MavenCli.LOCAL_REPO_PROPERTY);
if (userDefinedLocalRepo != null) {
return userDefinedLocalRepo;
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 1,3 @@
package org.apache.maven.cli;

/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
Expand All @@ -9,7 7,7 @@
* "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
* 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
Expand All @@ -18,58 16,54 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.maven.cli;

import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.apache.maven.api.services.ArtifactResolverException;
import org.apache.maven.api.services.ArtifactResolverResult;
import org.apache.maven.internal.impl.DefaultSession;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.apache.maven.api.ArtifactCoordinate;
import org.apache.maven.api.Session;
import org.apache.maven.api.services.ArtifactResolver;
import org.apache.maven.api.services.ArtifactResolverException;
import org.apache.maven.api.services.ArtifactResolverResult;
import org.apache.maven.artifact.repository.ArtifactRepository;
import org.apache.maven.execution.DefaultMavenExecutionResult;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequestPopulator;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.internal.aether.DefaultRepositorySystemSessionFactory;
import org.apache.maven.internal.impl.DefaultArtifactCoordinate;
import org.apache.maven.internal.impl.DefaultSession;
import org.apache.maven.internal.impl.DefaultSessionFactory;
import org.apache.maven.session.scope.internal.SessionScope;
import org.codehaus.plexus.PlexusContainer;
import org.codehaus.plexus.component.repository.exception.ComponentLookupException;
import org.eclipse.aether.RepositorySystemSession;
import org.eclipse.aether.artifact.Artifact;
import org.eclipse.aether.artifact.DefaultArtifact;
import org.eclipse.aether.resolution.ArtifactResolutionException;
import org.eclipse.aether.resolution.ArtifactResult;
import org.eclipse.aether.transfer.ArtifactNotFoundException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.net.URI;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

public class MavenStatusCommand
{
public class MavenStatusCommand {
/**
* In order to verify artifacts can be downloaded from the remote repositories we want to resolve an actual
* artifact. The Apache Maven artifact was chosen as it eventually, be it by proxy, mirror or directly, will be
* gathered from the central repository. The version is chosen arbitrarily since any listed should work.
*/
public static final Artifact APACHE_MAVEN_ARTIFACT = new DefaultArtifact(
"org.apache.maven",
"apache-maven",
null,
"pom",
"3.8.6"
);
public static final Artifact APACHE_MAVEN_ARTIFACT =
new DefaultArtifact("org.apache.maven", "apache-maven", null, "pom", "3.8.6");

private final MavenExecutionRequestPopulator mavenExecutionRequestPopulator;
private final ArtifactResolver artifactResolver;
private final RemoteRepositoryConnectionVerifier remoteRepositoryConnectionVerifier;
Expand All @@ -79,131 73,109 @@ public class MavenStatusCommand
private final PlexusContainer container;
private final SessionScope sessionScope;

public MavenStatusCommand( final PlexusContainer container ) throws ComponentLookupException
{
public MavenStatusCommand(final PlexusContainer container) throws ComponentLookupException {
this.container = container;
this.remoteRepositoryConnectionVerifier = new RemoteRepositoryConnectionVerifier( container );
mavenExecutionRequestPopulator = container.lookup( MavenExecutionRequestPopulator.class );
logger = LoggerFactory.getILoggerFactory().getLogger( MavenStatusCommand.class.getName() );
artifactResolver = container.lookup( ArtifactResolver.class );
defaultSessionFactory = container.lookup( DefaultSessionFactory.class );
repoSession = container.lookup( DefaultRepositorySystemSessionFactory.class );
sessionScope = container.lookup( SessionScope.class );
this.remoteRepositoryConnectionVerifier = new RemoteRepositoryConnectionVerifier(container);
mavenExecutionRequestPopulator = container.lookup(MavenExecutionRequestPopulator.class);
logger = LoggerFactory.getILoggerFactory().getLogger(MavenStatusCommand.class.getName());
artifactResolver = container.lookup(ArtifactResolver.class);
defaultSessionFactory = container.lookup(DefaultSessionFactory.class);
repoSession = container.lookup(DefaultRepositorySystemSessionFactory.class);
sessionScope = container.lookup(SessionScope.class);
}

public List<String> verify( CliRequest cliRequest )
throws Exception
{
public List<String> verify(CliRequest cliRequest) throws Exception {
// Populate the cliRequest with defaults and user settings
final MavenExecutionRequest mavenExecutionRequest =
mavenExecutionRequestPopulator.populateDefaults( cliRequest.request );
mavenExecutionRequestPopulator.populateDefaults(cliRequest.request);

final ArtifactRepository localRepository = cliRequest.getRequest().getLocalRepository();

final List<String> localRepositoryIssues =
verifyLocalRepository( Paths.get( URI.create( localRepository.getUrl() ) ) );
verifyLocalRepository(Paths.get(URI.create(localRepository.getUrl())));
final List<String> remoteRepositoryIssues = verifyRemoteRepositoryConnections(
cliRequest.getRequest().getRemoteRepositories(), mavenExecutionRequest );
final List<String> artifactResolutionIssues = verifyArtifactResolution( mavenExecutionRequest );
cliRequest.getRequest().getRemoteRepositories(), mavenExecutionRequest);
final List<String> artifactResolutionIssues = verifyArtifactResolution(mavenExecutionRequest);

// Collect all issues into a single list
return Stream.of( localRepositoryIssues, remoteRepositoryIssues, artifactResolutionIssues )
.flatMap( Collection::stream )
.collect( Collectors.toList() );
return Stream.of(localRepositoryIssues, remoteRepositoryIssues, artifactResolutionIssues)
.flatMap(Collection::stream)
.collect(Collectors.toList());
}

private List<String> verifyRemoteRepositoryConnections(
final List<ArtifactRepository> remoteRepositories,
final MavenExecutionRequest mavenExecutionRequest
) {
final List<ArtifactRepository> remoteRepositories, final MavenExecutionRequest mavenExecutionRequest) {
final List<String> issues = new ArrayList<>();

for ( ArtifactRepository remoteRepository : remoteRepositories )
{
final RepositorySystemSession repositorySession = repoSession.newRepositorySession( mavenExecutionRequest );
remoteRepositoryConnectionVerifier.verifyConnectionToRemoteRepository( repositorySession, remoteRepository )
.ifPresent( issues::add );
for (ArtifactRepository remoteRepository : remoteRepositories) {
final RepositorySystemSession repositorySession = repoSession.newRepositorySession(mavenExecutionRequest);
remoteRepositoryConnectionVerifier
.verifyConnectionToRemoteRepository(repositorySession, remoteRepository)
.ifPresent(issues::add);
}

return issues;
}

private List<String> verifyArtifactResolution( final MavenExecutionRequest mavenExecutionRequest )
{
final Session session = this.defaultSessionFactory.getSession(
new MavenSession(
container,
repoSession.newRepositorySession( mavenExecutionRequest ),
mavenExecutionRequest,
new DefaultMavenExecutionResult()
)
);
private List<String> verifyArtifactResolution(final MavenExecutionRequest mavenExecutionRequest) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is 1 step too much. Is this the only way to verify if a remote repository is accessible? If you need to use an explicit file instead of a directory, is it possible to use http HEAD ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[...] 1 step too much [...]

Just to verify: are you referring to the fact that this code actually downloads a file (e.g., it could've been an HTTP HEAD request), or to the fact that the --status verifies if artifact resolution works?

In the case of the former: is a remote repository required to support an HTTP HEAD request? Could we rely on the fact that if HTTP HEAD is OK, HTTP GET will be OK, too?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It depends on what you define as "artifact resolution works". I'm not interested if the implementation is correct. I wish there's a way to only confirm that the connection works. It is about returning questions on StackOverflow that say Maven can't download things, but it is just that it cannot reach a repository. Possible rootcauses are missing proxies (or misconfigured) and misconfigured mirrors. Maybe @michael-o or @cstamas can think of a low-level reliable way to conform this.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my experience this is not testing a random artifact which works but more enabling the aether logs which help, ultimately logging the request to be able to replay it with curl to do the check. Rest is random tests which can easily be proven false positive/negative due to proxies (correct) configuration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The goal of this code is not to explain what is wrong and how the user should fix it. I agree with @rmannibucau that the Aether logs are more suitable for that. What this code wants to do is tell the user they have a problem, without even building a project.

Ideally, in the case of the StackOverflow questions that @rfscholte refers to, we could say "please share the output of mvn --status". Their output might look like this for example:

[INFO] Local repository setup check completed
[INFO] Connection check for repository 'corporate-repo' at 'https://pkgs.dev.azure.com/big-corporate/project/_packaging/whatever-repository/maven/v1' completed
Downloading from corporate-repo: https://pkgs.dev.azure.com/big-corporate/project/_packaging/whatever-repository/maven/v1/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6.pom
Downloading from misconfigured-mirror: https://non-existing.example.com/maven2/org/apache/maven/apache-maven/3.8.6/apache-maven-3.8.6.pom
[INFO] Artifact resolution check completed
[INFO]
[ERROR] The following issues where found
[ERROR] 1.  Connection to misconfigured-mirror [https://non-existing.example.com/maven2/] not possible. Cause: non-existing.example.com: nodename nor servname provided, or not known
[ERROR] 2.  Could not find artifact org.apache.maven:apache-maven:pom:3.8.6 in corporate-repo (https://pkgs.dev.azure.com/big-corporate/project/_packaging/whatever-repository/maven/v1)
[ERROR] 3.  Could not transfer artifact org.apache.maven:apache-maven:pom:3.8.6 from/to misconfigured-mirror (https://non-existing.example.com/maven2/): non-existing.example.com: nodename nor servname provided, or not known

Even though this doesn't tell the user the solution, it points them in a few directions where they could look. It's a lot more compact than the complete Aether logs - which the user could still inspect, in case this message doesn't point them in the right direction already.

final Session session = this.defaultSessionFactory.getSession(new MavenSession(
container,
repoSession.newRepositorySession(mavenExecutionRequest),
mavenExecutionRequest,
new DefaultMavenExecutionResult()));

sessionScope.enter();
try
{
sessionScope.seed( DefaultSession.class, (DefaultSession) session );
try {
sessionScope.seed(DefaultSession.class, (DefaultSession) session);

ArtifactCoordinate artifactCoordinate = new DefaultArtifactCoordinate( session, APACHE_MAVEN_ARTIFACT );
ArtifactResolverResult resolverResult = artifactResolver.resolve( session,
Collections.singleton( artifactCoordinate ) );
ArtifactCoordinate artifactCoordinate = new DefaultArtifactCoordinate(session, APACHE_MAVEN_ARTIFACT);
ArtifactResolverResult resolverResult =
artifactResolver.resolve(session, Collections.singleton(artifactCoordinate));

resolverResult.getArtifacts().forEach( ( key, value ) ->
logger.debug( "Successfully resolved {} to {}", key.toString(), value.toString() )
);
resolverResult
.getArtifacts()
.forEach((key, value) ->
logger.debug("Successfully resolved {} to {}", key.toString(), value.toString()));

return Collections.emptyList();
}
catch ( ArtifactResolverException are )
{
return extractIssuesFromArtifactResolverException( are );
}
finally
{
} catch (ArtifactResolverException are) {
return extractIssuesFromArtifactResolverException(are);
} finally {
sessionScope.exit();
logger.info( "Artifact resolution check completed" );
logger.info("Artifact resolution check completed");
}
}

private List<String> extractIssuesFromArtifactResolverException( final Exception exception )
{
private List<String> extractIssuesFromArtifactResolverException(final Exception exception) {
final boolean isArtifactResolutionException = exception.getCause() instanceof ArtifactResolutionException;
if ( isArtifactResolutionException )
{
final ArtifactResolutionException are = ( ArtifactResolutionException ) exception.getCause();
if (isArtifactResolutionException) {
final ArtifactResolutionException are = (ArtifactResolutionException) exception.getCause();
return are.getResults().stream()
.map( ArtifactResult::getExceptions )
.flatMap( List::stream )
.map( ArtifactNotFoundException.class::cast )
.map( Throwable::getMessage )
.collect( Collectors.toList() );
}
else
{
return Collections.singletonList( exception.getMessage() );
.map(ArtifactResult::getExceptions)
.flatMap(List::stream)
.map(ArtifactNotFoundException.class::cast)
.map(Throwable::getMessage)
.collect(Collectors.toList());
} else {
return Collections.singletonList(exception.getMessage());
}
}

private List<String> verifyLocalRepository( final Path localRepositoryPath )
{
private List<String> verifyLocalRepository(final Path localRepositoryPath) {
final List<String> issues = new ArrayList<>();

if ( !Files.isDirectory( localRepositoryPath ) )
{
issues.add( "Local repository is not a directory." );
if (!Files.isDirectory(localRepositoryPath)) {
issues.add("Local repository is not a directory.");
}

if ( !Files.isReadable( localRepositoryPath ) )
{
issues.add( "No read permissions on local repository." );
if (!Files.isReadable(localRepositoryPath)) {
issues.add("No read permissions on local repository.");
}

if ( !Files.isWritable( localRepositoryPath ) )
{
issues.add( "No write permissions on local repository." );
if (!Files.isWritable(localRepositoryPath)) {
issues.add("No write permissions on local repository.");
}

mthmulders marked this conversation as resolved.
Show resolved Hide resolved
return issues;
}
}

Loading