private void makeExecutable(final File baseDir, final String scriptName) { if (!Os.isFamily(Os.FAMILY_WINDOWS)) { onDirectory(baseDir).apply( fileTaskBuilder.chmod(path("/")) .include("**/" + scriptName) .permissions("u+x") ); } }
@Override public void configureNexus() { onDirectory(getConfiguration().getTargetDirectory()).apply( fileTaskBuilder.properties(path("nexus/conf/nexus.properties")) .property("application-port", String.valueOf(getPort())) ); }
@Override protected void createBundle() { BundleConfiguration config = getConfiguration(); File bundle = config.getBundle(); if ( bundle == null ) { return; } if ( bundle.isDirectory() ) { onDirectory( config.getTargetDirectory() ).apply( getFileTaskBuilder().copy().directory( file( bundle ) ) .to().directory( path( "/" ) ) ); } else { onDirectory( config.getTargetDirectory() ).apply( getFileTaskBuilder().expand( file( bundle ) ) .exclude( "*/contexts/**" ) .exclude( "*/contexts-available/**" ) .exclude( "*/javadoc/**" ) .exclude( "*/overlays/**" ) .exclude( "*/webapps/**" ) .to().directory( path( "/" ) ) ); } }
if (plugin.isDirectory()) { overlays.add( fileTaskBuilder.copy() .directory(file(plugin)) .to().directory(path("sonatype-work/nexus/plugin-repository")) ); fileTaskBuilder.expand(file(plugin)) .to().directory(path("sonatype-work/nexus/plugin-repository")) ); fileTaskBuilder.replace() .inFile(path("nexus/conf/jetty.xml")) .replace( "org.sonatype.nexus.bootstrap.jetty.InstrumentedSelectChannelConnector", "org.eclipse.jetty.server.nio.BlockingChannelConnector" .failIfFileDoesNotExist() ); fileTaskBuilder.properties(path("sonatype-work/nexus/conf/logback.properties")) .property("root.level", getLogLevel() == null ? DEFAULT_LOG_LEVEL : getLogLevel()) .property("appender.pattern", getLogPattern() == null ? DEFAULT_LOG_PATTERN : getLogPattern()) .property("appender.file", "${nexus.log-config-dir}/../logs/nexus.log") ); writer.flush(); overlays.add( fileTaskBuilder.create().file(path("sonatype-work/nexus/conf/logback-test.xml"))
onDirectory( config.getTargetDirectory() ).apply( getFileTaskBuilder().copy() .file( file( serverXml ) ) .to().file( path( getName() + "/etc/jetty.xml" ) ) .filterUsing( "port.https", String.valueOf( httpsPort ) ) .filterUsing( "port.http", String.valueOf( getPort() ) ) .filterUsing( "system.properties", buff.toString() ) ); serverXml.delete();
private void makeScriptsExecutable() { final File binDir = new File( getConfiguration().getTargetDirectory(), getName() + "/bin" ); getFileTaskBuilder().chmod( file( binDir ) ) .include( "**/*.sh" ) .permissions( "u+x" ) .run(); }
onDirectory(nexusDir).apply( fileTaskBuilder.exec().spawn() .script(path("bin/nexus" + (Os.isFamily(Os.FAMILY_WINDOWS) ? ".bat" : ""))) .withArgument("console") .withEnv(strategy.commandMonitorProperty(), String.valueOf(commandMonitorPort)) .withEnv(strategy.keepAliveProperty(), String.valueOf(keepAlivePort)) );
@Override public void configureNexus() { final Properties nexusProperties = new Properties(); nexusProperties.setProperty("application-port", String.valueOf(getPort())); nexusProperties.setProperty("application-port-ssl", String.valueOf(getSslPort())); nexusProperties.setProperty(commandMonitorProperty(), String.valueOf(commandMonitorPort)); nexusProperties.setProperty(keepAliveProperty(), String.valueOf(keepAlivePort)); if (getConfiguration().getContextPath() != null) { nexusProperties.setProperty("nexus-webapp-context-path", getConfiguration().getContextPath()); } final Map<String, String> systemProperties = getConfiguration().getSystemProperties(); if (!systemProperties.isEmpty()) { for (final Map.Entry<String, String> entry : systemProperties.entrySet()) { nexusProperties.setProperty(entry.getKey(), entry.getValue() == null ? "true" : entry.getValue()); } } onDirectory(getConfiguration().getTargetDirectory()).apply( fileTaskBuilder.properties(path("nexus/conf/nexus-test.properties")) .properties(nexusProperties) ); }
private void removePluginsPresentInBundle() { final Map<String, File> workDirPlugins = listPlugins( new File(getWorkDirectory(), "plugin-repository") ); if (workDirPlugins.size() > 0) { final Map<String, File> bundlePlugins = listPlugins( new File(getNexusDirectory(), "nexus/WEB-INF/plugin-repository") ); for (final Map.Entry<String, File> entry : workDirPlugins.entrySet()) { if (bundlePlugins.containsKey(entry.getKey())) { log.info( "{} ({}) removing plugin '{}' already present in extracted bundle", getName(), getConfiguration().getId(), entry.getValue().getName() ); fileTaskBuilder.delete().directory(file(entry.getValue())).run(); } } } }
private void installWARs() { final SCBC config = getConfiguration(); final List<WAR> wars = config.getWARs(); for ( WAR war : wars ) { if ( war.getFile().isDirectory() ) { onDirectory( config.getTargetDirectory() ).apply( getFileTaskBuilder().copy() .directory( file( war.getFile() ) ) .to().directory( path( getName() + "/" + getWebAppPath() + "/" + war.getContext() ) ) ); } else { onDirectory( config.getTargetDirectory() ).apply( getFileTaskBuilder().expand( file( war.getFile() ) ) .to().directory( path( getName() + "/" + getWebAppPath() + "/" + war.getContext() ) ) ); } } }