public class JarCopier extends Object
Modifier and Type | Field and Description |
---|---|
static int |
STRATEGY_DELETE_COPY
Copy source Jar only if greater or same version as target
Jar after deleting target Jar.
|
static int |
STRATEGY_INTERACTIVE
Interactive, let the user chose (requires execution on command prompt).
|
static int |
STRATEGY_NO_COPY
Do not copy source Jar (leave target Jar as is).
|
static int |
STRATEGY_PLAIN_COPY
Copy source Jar regardless of target Jar
(may overwrite or cause mixed versions).
|
static int |
STRATEGY_RENAME_COPY
Copy source Jar only if greater or same version as target
Jar after renaming target Jar (.bak-[timestamp]).
|
Constructor and Description |
---|
JarCopier()
Constructor.
|
JarCopier(int strategy)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
copyJarDirectory(File fromJarDirectory,
File toJarDirectory)
Copies Jars from a source directory to a target one taking into
consideration Jar versions.
|
void |
copyJarDirectory(String fromJarDirectory,
String toJarDirectory)
Copies Jars from a source directory to a target one taking into
consideration Jar versions.
|
void |
copyJarFile(File sourceJarFile,
File toDirectory)
Copies a single Jar to a target directory, taking into
consideration Jar versions.
|
void |
copyJarFile(String sourceJarFile,
String toDirectory)
Copies a single Jar to a target directory, taking into
consideration Jar versions.
|
int |
getStrategy()
Gets the strategy used when encountering duplicates or version conflicts.
|
static void |
main(String[] args) |
public static final int STRATEGY_RENAME_COPY
public static final int STRATEGY_DELETE_COPY
public static final int STRATEGY_NO_COPY
public static final int STRATEGY_PLAIN_COPY
public static final int STRATEGY_INTERACTIVE
public JarCopier()
JarCopier(int)
with
STRATEGY_RENAME_COPY
.public JarCopier(int strategy)
strategy
- the strategy to use when encountering
duplicates/conflictspublic int getStrategy()
public void copyJarDirectory(String fromJarDirectory, String toJarDirectory) throws IOException
fromJarDirectory
- directory to copy Jars fromtoJarDirectory
- directory to copy Jars toIOException
- problem copying filespublic void copyJarDirectory(File fromJarDirectory, File toJarDirectory) throws IOException
fromJarDirectory
- directory to copy Jars fromtoJarDirectory
- directory to copy Jars toIOException
- problem copying filespublic void copyJarFile(String sourceJarFile, String toDirectory) throws IOException
sourceJarFile
- the Jar file to copytoDirectory
- directory to copy the jar intoIOException
- problem copying filespublic void copyJarFile(File sourceJarFile, File toDirectory) throws IOException
sourceJarFile
- the Jar file to copytoDirectory
- directory to copy the jar intoIOException
- problem copying filespublic static void main(String[] args) throws IOException
IOException
Copyright © 2008–2021 Norconex Inc.. All rights reserved.