public void transformForResolve( Artifact artifact, RepositoryRequest request ) throws ArtifactResolutionException, ArtifactNotFoundException { if ( Artifact.RELEASE_VERSION.equals( artifact.getVersion() ) ) { try { String version = resolveVersion( artifact, request ); if ( Artifact.RELEASE_VERSION.equals( version ) ) { throw new ArtifactNotFoundException( "Unable to determine the release version", artifact ); } artifact.setBaseVersion( version ); artifact.updateVersion( version, request.getLocalRepository() ); } catch ( RepositoryMetadataResolutionException e ) { throw new ArtifactResolutionException( e.getMessage(), artifact, e ); } } }
public void transformForResolve( Artifact artifact, RepositoryRequest request ) throws ArtifactResolutionException, ArtifactNotFoundException { if ( Artifact.LATEST_VERSION.equals( artifact.getVersion() ) ) { try { String version = resolveVersion( artifact, request ); if ( Artifact.LATEST_VERSION.equals( version ) ) { throw new ArtifactNotFoundException( "Unable to determine the latest version", artifact ); } artifact.setBaseVersion( version ); artifact.updateVersion( version, request.getLocalRepository() ); } catch ( RepositoryMetadataResolutionException e ) { throw new ArtifactResolutionException( e.getMessage(), artifact, e ); } } }
throw new ArtifactNotFoundException( "System artifact: " + artifact + " has no file attached", artifact ); throw new ArtifactNotFoundException( "System artifact: " + artifact + " not found in path: " + systemFile, artifact ); throw new ArtifactNotFoundException( "System artifact: " + artifact + " is not a file: " + systemFile, artifact ); throw new ArtifactNotFoundException( e.getMessage(), artifact, remoteRepositories, e );
throw new ArtifactNotFoundException( "Catch!", artifact );
private void assertResolved( Artifact artifact ) throws ArtifactNotFoundException { if ( !artifact.isResolved() || artifact.getFile() == null || !artifact.getFile().canRead() ) { throw new ArtifactNotFoundException( "Artifact is not resolved", artifact ); } }
throw new ArtifactNotFoundException( "Catch!", artifact );
protected void unpackBaseImage(File buildDir, boolean useDefaultPrefix) throws Exception { String imageName = project.getProperties().getProperty(DOCKER_BASE_IMAGE_PROPERTY); Objects.notNull(imageName, DOCKER_BASE_IMAGE_PROPERTY); ImageMavenCoords baseImageCoords = ImageMavenCoords.parse(imageName, useDefaultPrefix); String coords = baseImageCoords.getAetherCoords(); Artifact artifact = repositorySystem.createArtifactWithClassifier(baseImageCoords.getGroupId(), baseImageCoords.getArtifactId(), baseImageCoords.getVersion(), baseImageCoords.getType(), baseImageCoords.getClassifier()); getLog().info("Resolving Jube image: " + artifact); ArtifactResolutionRequest request = new ArtifactResolutionRequest(); request.setArtifact(artifact); request.setLocalRepository(localRepository); request.setRemoteRepositories(pomRemoteRepositories); ArtifactResolutionResult result = artifactResolver.resolve(request); if (!result.isSuccess()) { throw new ArtifactNotFoundException("Cannot download Jube image", artifact); } getLog().info("Resolved Jube image: " + artifact); if (artifact.getFile() != null) { File file = artifact.getFile(); getLog().info("File: " + file); if (!file.exists() || file.isDirectory()) { throw new MojoExecutionException("Resolved file for " + coords + " is not a valid file: " + file.getAbsolutePath()); } getLog().info("Unpacking base image " + file.getAbsolutePath() + " to build dir: " + buildDir); Zips.unzip(new FileInputStream(file), buildDir); } }