private static void copyArtifact ( File inputDir , File outputDir , LibertyFeature feature , Constants . ArtifactType type ) throws MavenRepoGeneratorException { MavenCoordinates artifact = feature . getMavenCoordinates ( ) ; File artifactDir = new File ( outputDir , Utils . getRepositorySubpath ( artifact ) ) ; artifactDir . mkdirs ( ) ; if ( ! artifactDir . isDirectory ( ) ) { throw new MavenRepoGeneratorException ( "Artifact directory " + artifactDir + " could not be created." ) ; } File sourceFile = new File ( inputDir , feature . getSymbolicName ( ) + type . getLibertyFileExtension ( ) ) ; System . out . println ( "Source file: " + sourceFile ) ; if ( ! sourceFile . exists ( ) ) { throw new MavenRepoGeneratorException ( "Artifact source file " + sourceFile + " does not exist." ) ; } File targetFile = new File ( artifactDir , Utils . getFileName ( artifact , type ) ) ; try { Files . copy ( sourceFile . toPath ( ) , targetFile . toPath ( ) , StandardCopyOption . REPLACE_EXISTING ) ; } catch ( IOException e ) { throw new MavenRepoGeneratorException ( "Could not copy artifact from " + sourceFile . getAbsolutePath ( ) + " to " + targetFile . getAbsolutePath ( ) , e ) ; } }
Copy artifact file from inputDir to outputDir .