本文整理汇总了Java中org.codehaus.plexus.archiver.jar.JarArchiver类的典型用法代码示例。如果您正苦于以下问题:Java JarArchiver类的具体用法?Java JarArchiver怎么用?Java JarArchiver使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JarArchiver类属于org.codehaus.plexus.archiver.jar包,在下文中一共展示了JarArchiver类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: ArchiveTask
import org.codehaus.plexus.archiver.jar.JarArchiver; //导入依赖的package包/类
public ArchiveTask(
MavenArchiveConfiguration archiveConfig ,JarArchiver lexArchiver
,String classifier
,String id, String version, String name,String description
,List<String> categories, Boolean trial
,String luceeCoreVersion, String luceeLoaderVersion ,Boolean startBundles
,List<? extends Config> cacheHandlers ,List<? extends Config> ormEngines
,List<? extends Config> monitors ,List<? extends Config> searchEngines
,List<? extends Config> resourceProviders ,List<? extends Config> amfs
,List<? extends Config> jdbcDrivers ,List<? extends Config> mappings
,List<? extends Config> eventGateways
) {
this.archiveConfig = archiveConfig;
this.lexArchiver = lexArchiver;
this.classifier = classifier;
this.id = id;
this.version = version;
this.name = name;
this.description = description;
this.categories = categories;
this.trial = trial;
this.luceeCoreVersion = luceeCoreVersion;
this.luceeLoaderVersion = luceeLoaderVersion;
this.startBundles = startBundles;
this.cacheHandlers = cacheHandlers;
this.ormEngines = ormEngines;
this.monitors = monitors;
this.searchEngines = searchEngines;
this.resourceProviders = resourceProviders;
this.amfs = amfs;
this.jdbcDrivers = jdbcDrivers;
this.mappings = mappings;
this.eventGateways = eventGateways;
}
示例2: testExport
import org.codehaus.plexus.archiver.jar.JarArchiver; //导入依赖的package包/类
@Test
public void testExport() throws Exception {
ExportSchemaMojo mojo = new ExportSchemaMojo();
mojo.adminUser = "sa";
mojo.user = "sa";
mojo.schema = "db1";
mojo.outputDirectory = new File("target/dump");
mojo.driver = org.h2.Driver.class.getName();
mojo.url = "jdbc:h2:file:./target/db1";
mojo.jarArchiver = new JarArchiver();
DriverManagerUtil.registerDriver(mojo.driver);
Connection conn = null;
try {
conn = DriverManager.getConnection(mojo.url, mojo.user, null);
Statement stmt = conn.createStatement();
stmt.execute("CREATE TABLE IF NOT EXISTS test (id integer, name varchar(100))");
stmt.execute("INSERT INTO test VALUES(1, 'abc')");
conn.commit();
} catch (Exception ex) {
Assert.fail(ex.toString());
} finally {
ConnectionUtil.close(conn);
}
mojo.execute();
}
示例3: process
import org.codehaus.plexus.archiver.jar.JarArchiver; //导入依赖的package包/类
private File process() throws IOException, ManifestException {
getLog().info("Building webjar for " + project.getArtifactId());
File output = new File(buildDirectory, webjar.getOutputFileName());
FileUtils.deleteQuietly(output);
// Compute the set of selected files:
Collection<File> selected = webjar.getSelectedFiles();
if (selected.isEmpty()) {
getLog().warn("No file selected in the webjar - skipping creation");
return null;
}
String root = computeRoot();
FileUtils.deleteQuietly(output);
// Web jar are jar file, so use the Plexus Archiver.
JarArchiver archiver = new JarArchiver();
archiver.enableLogging(new PlexusLoggerWrapper(getLog()));
String base = webjar.getFileset().getDirectory();
for (File file : selected) {
final String destFileName = root + "/" + file.getAbsolutePath().substring(base.length() + 1);
getLog().debug(file.getName() + " => " + destFileName);
archiver.addFile(file, destFileName);
}
// Extend the manifest with webjar data - this is not required by the webjar specification
Manifest manifest = Manifest.getDefaultManifest();
manifest.getMainSection().addConfiguredAttribute(new Manifest.Attribute("Webjar-Name", webjar.getName()));
manifest.getMainSection().addConfiguredAttribute(new Manifest.Attribute("Webjar-Version", webjar.getVersion()));
manifest.getMainSection().addConfiguredAttribute(new Manifest.Attribute("Created-By", "Wisdom Framework " +
BuildConstants.get("WISDOM_PLUGIN_VERSION")));
archiver.addConfiguredManifest(manifest);
archiver.setDestFile(output);
archiver.createArchive();
return output;
}
示例4: getJarArchiver
import org.codehaus.plexus.archiver.jar.JarArchiver; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
public JarArchiver getJarArchiver()
{
return jarArchiver;
}
示例5: setJarArchiver
import org.codehaus.plexus.archiver.jar.JarArchiver; //导入依赖的package包/类
/**
* @param jarArchiver {@link JarArchiver}
*/
public void setJarArchiver( JarArchiver jarArchiver )
{
this.jarArchiver = jarArchiver;
}
示例6: copyFile
import org.codehaus.plexus.archiver.jar.JarArchiver; //导入依赖的package包/类
/**
* Copy file from source to destination. The directories up to <code>destination</code> will be created if they
* don't already exist. if the <code>onlyIfModified</code> flag is <tt>false</tt>, <code>destination</code> will be
* overwritten if it already exists. If the flag is <tt>true</tt> destination will be overwritten if it's not up to
* date.
* <p/>
*
* @param context the packaging context
* @param source an existing non-directory <code>File</code> to copy bytes from
* @param destination a non-directory <code>File</code> to write bytes to (possibly overwriting).
* @param targetFilename the relative path of the file from the webapp root directory
* @param onlyIfModified if true, copy the file only if the source has changed, always copy otherwise
* @return true if the file has been copied/updated, false otherwise
* @throws IOException if <code>source</code> does not exist, <code>destination</code> cannot be written to, or an
* IO error occurs during copying
*/
protected boolean copyFile( WarPackagingContext context, File source, File destination, String targetFilename,
boolean onlyIfModified )
throws IOException
{
if ( onlyIfModified && destination.lastModified() >= source.lastModified() )
{
context.getLog().debug( " * " + targetFilename + " is up to date." );
return false;
}
else
{
if ( source.isDirectory() )
{
context.getLog().warn( " + " + targetFilename + " is packaged from the source folder" );
try
{
JarArchiver archiver = context.getJarArchiver();
archiver.addDirectory( source );
archiver.setDestFile( destination );
archiver.createArchive();
}
catch ( ArchiverException e )
{
String msg = "Failed to create " + targetFilename;
context.getLog().error( msg, e );
IOException ioe = new IOException( msg );
ioe.initCause( e );
throw ioe;
}
}
else
{
FileUtils.copyFile( source.getCanonicalFile(), destination );
// preserve timestamp
destination.setLastModified( source.lastModified() );
context.getLog().debug( " + " + targetFilename + " has been copied." );
}
return true;
}
}
示例7: getJarArchiver
import org.codehaus.plexus.archiver.jar.JarArchiver; //导入依赖的package包/类
/**
* @return {@link JarArchiver}
*/
public JarArchiver getJarArchiver() {
return jarArchiver;
}
示例8: DARMojoContextImpl
import org.codehaus.plexus.archiver.jar.JarArchiver; //导入依赖的package包/类
public DARMojoContextImpl(final JarArchiver jarArchiver) {
this.jarArchiver = jarArchiver;
}
示例9: getJarArchiver
import org.codehaus.plexus.archiver.jar.JarArchiver; //导入依赖的package包/类
public JarArchiver getJarArchiver()
{
return jarArchiver;
}
示例10: setJarArchiver
import org.codehaus.plexus.archiver.jar.JarArchiver; //导入依赖的package包/类
public void setJarArchiver( JarArchiver jarArchiver )
{
this.jarArchiver = jarArchiver;
}
示例11: getJarArchiver
import org.codehaus.plexus.archiver.jar.JarArchiver; //导入依赖的package包/类
/**
* Returns the Jar archiver needed for archiving classes directory into jar file under WEB-INF/lib.
*
* @return the jar archiver to user
*/
JarArchiver getJarArchiver();
示例12: setJarArchiver
import org.codehaus.plexus.archiver.jar.JarArchiver; //导入依赖的package包/类
/**
* @param jarArchiver
* {@link JarArchiver}
*/
public void setJarArchiver(JarArchiver jarArchiver) {
this.jarArchiver = jarArchiver;
}