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")) ); overlays.add( fileTaskBuilder.replace() .inFile(path("nexus/conf/jetty.xml")) .replace( "org.sonatype.nexus.bootstrap.jetty.InstrumentedSelectChannelConnector", 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()) writer.flush(); overlays.add( fileTaskBuilder.create().file(path("sonatype-work/nexus/conf/logback-test.xml")) .containing(baos.toString("UTF-8")) .encodedAs("UTF-8") overlays.add( fileTaskBuilder.replace() .inFile(path("nexus/conf/jetty-https.xml"))
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(); } } } }
@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) ); }
this.fileTaskBuilder.chmod( file( binDir ) ) .exclude( "**/*.bat" ) .exclude( "**/*.dll" )
@Override public void configureNexus() { onDirectory(getConfiguration().getTargetDirectory()).apply( fileTaskBuilder.properties(path("nexus/conf/nexus.properties")) .property("application-port", String.valueOf(getPort())) ); }
private void makeScriptsExecutable() { final File binDir = new File( getConfiguration().getTargetDirectory(), getName() + "/bin" ); getFileTaskBuilder().chmod( file( binDir ) ) .include( "**/*.sh" ) .permissions( "u+x" ) .run(); }
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 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( "/" ) ) ); } }
onDirectory(nexusDir).apply( fileTaskBuilder.exec().spawn() .script(path("bin/nexus" + (Os.isFamily(Os.FAMILY_WINDOWS) ? ".bat" : ""))) .withArgument("console") .withEnv(strategy.commandMonitorProperty(), String.valueOf(commandMonitorPort))
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() ) ) ); } } }