Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into JENKINS-9693
Conflicts:
	maven-agent/src/main/java/hudson/maven/agent/Main.java
	maven3-agent/src/main/java/org/jvnet/hudson/maven3/agent/Maven3Main.java
  • Loading branch information
rbierman committed Aug 12, 2013
2 parents 021aba7 + 482cebc commit 7005329
Show file tree
Hide file tree
Showing 29 changed files with 1,975 additions and 147 deletions.
20 changes: 1 addition & 19 deletions .gitignore
Expand Up @@ -13,22 +13,4 @@ work
.project
build

war/images/16x16
war/images/24x24
war/images/32x32
war/images/48x48
jenkins.war
RPMS
SRPMS
debian/binary
debian/debian/jenkins
debian/debian/jenkins.substvars
debian/debian/files
debian/build-stamp
debian/configure-stamp
*.debhelper
*.debhelper.log
jenkins_*.build
jenkins_*.changes
*.deb
push-build.sh

3 changes: 1 addition & 2 deletions maven-agent/pom.xml
Expand Up @@ -27,8 +27,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci.main.maven</groupId>
<artifactId>maven-modules</artifactId>
<version>1.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
<version>1.5-SNAPSHOT</version>
</parent>

<artifactId>maven-agent</artifactId>
Expand Down
43 changes: 21 additions & 22 deletions maven-agent/src/main/java/hudson/maven/agent/Main.java
Expand Up @@ -31,8 +31,8 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.InvocationTargetException;
import java.net.InetAddress;
import java.net.Socket;
import java.net.InetAddress;
import java.net.URL;
import java.util.HashSet;
import java.util.Iterator;
Expand All @@ -59,30 +59,15 @@ public class Main {
* Used to pass the classworld instance to the code running inside the remoting system.
*/
private static Launcher launcher;

/**
* Version >= 2.0.6?
*/
private static boolean is206OrLater;
* Version >= 2.0.6?
*/
private static boolean is206OrLater;

public static void main(String[] args) throws Exception {
main(new File(args[0]),new File(args[1]),new File(args[2]),Integer.parseInt(args[3]),
args.length==4?null:new File(args[4]));
}
/**
* Called by the code in remoting to add more plexus components.
*/
public static void addPlexusComponents(URL[] modules) {

try {
ClassRealm realm = launcher.getWorld().getRealm(is206OrLater?"plexus.core.maven":"plexus.core");
for (int i=0; i<modules.length; i++) {
realm.addConstituent(modules[i]);
}
} catch (NoSuchRealmException e) {
throw new Error(e);
}
}

/**
*
Expand Down Expand Up @@ -127,7 +112,7 @@ public static void main(File m2Home, File remotingJar, File interceptorJar, int
launcher = new Launcher();
launcher.setSystemClassLoader(Main.class.getClassLoader());
launcher.configure(Main.class.getResourceAsStream(
is206OrLater?"classworlds-2.0.6.conf":"classworlds.conf"));
is206OrLater ?"classworlds-2.0.6.conf":"classworlds.conf"));

// have it eventually delegate to this class so that this can be visible

Expand Down Expand Up @@ -191,9 +176,23 @@ private static void versionCheck() {
}
}

/**
* Called by the code in remoting to add more plexus components.
* @since 1.3
*/
public static void addPlexusComponents(URL[] modules) {
try {
ClassRealm realm = launcher.getWorld().getRealm(is206OrLater?"plexus.core.maven":"plexus.core");
for (int i=0; i<modules.length; i++) {
realm.addConstituent(modules[i]);
}
} catch (NoSuchRealmException e) {
throw new Error(e);
}
}

/**
* Called by the code in remoting to launch.
* @throws org.codehaus.plexus.classworlds.realm.NoSuchRealmException
*/
public static int launch(String[] args) throws NoSuchMethodException, IllegalAccessException, NoSuchRealmException, InvocationTargetException, ClassNotFoundException {
//ClassWorld world = ClassWorldAdapter.getInstance( launcher.getWorld() );
Expand Down
3 changes: 1 addition & 2 deletions maven-interceptor/pom.xml
Expand Up @@ -27,8 +27,7 @@ THE SOFTWARE.
<parent>
<groupId>org.jenkins-ci.main.maven</groupId>
<artifactId>maven-modules</artifactId>
<version>1.3-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
<version>1.5-SNAPSHOT</version>
</parent>

<artifactId>maven-interceptor</artifactId>
Expand Down
5 changes: 0 additions & 5 deletions maven3-agent/.gitignore

This file was deleted.

3 changes: 2 additions & 1 deletion maven3-agent/pom.xml
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.jenkins-ci.main.maven</groupId>
<artifactId>maven-modules</artifactId>
<version>1.3-SNAPSHOT</version>
<version>1.5-SNAPSHOT</version>
</parent>
<artifactId>maven3-agent</artifactId>
<name>Jenkins Maven3 CLI Agent</name>
Expand All @@ -19,6 +19,7 @@
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-embedder</artifactId>
<version>${maven3.0.x.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
Expand Down
Expand Up @@ -23,6 +23,10 @@
*/
package org.jvnet.hudson.maven3.agent;

import org.codehaus.plexus.classworlds.launcher.Launcher;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;

import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
Expand All @@ -32,15 +36,10 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.Socket;
import java.net.InetAddress;
import java.net.Socket;
import java.net.URL;

import org.codehaus.plexus.classworlds.launcher.Launcher;
import org.codehaus.plexus.classworlds.realm.ClassRealm;
import org.codehaus.plexus.classworlds.realm.NoSuchRealmException;



/**
* Entry point for launching Maven 3 and Hudson remoting in the same VM, in the
Expand All @@ -60,25 +59,10 @@ public class Maven3Main {
* remoting system.
*/
private static Launcher launcher;

/**
* Called by the code in remoting to add more plexus components.
*/
public static void addPlexusComponents(URL[] modules) {
try {
ClassRealm realm = launcher.getWorld().getRealm("plexus.core");
for (int i=0; i<modules.length; i++) {
realm.addURL(modules[i]);
}
} catch (NoSuchRealmException e) {
throw new Error(e);
}
}


public static void main(String[] args) throws Exception {
public static void main(String... args) throws Exception {
main(new File(args[0]), new File(args[1]),new File(args[2]),
Integer.parseInt(args[3]));
new File(args[3]), Integer.parseInt(args[4]));
}

/**
Expand All @@ -90,12 +74,14 @@ public static void main(String[] args) throws Exception {
* Hudson's remoting.jar that we'll load.
* @param interceptorJar
* maven-listener.jar that we'll load.
* @param interceptorCommonJar
* maven3-interceptor-commons.jar we'll load
* @param tcpPort
* TCP socket that the launching Hudson will be listening to.
* This is used for the remoting communication.
*/
public static void main(File m2Home, File remotingJar, File interceptorJar,
int tcpPort) throws Exception {
public static void main(File m2Home, File remotingJar, File interceptorJar
, File interceptorCommonJar, int tcpPort) throws Exception {
// Unix master with Windows slave ends up passing path in Unix format,
// so convert it to Windows format now so that no one chokes with the
// path format later.
Expand All @@ -114,6 +100,8 @@ public static void main(File m2Home, File remotingJar, File interceptorJar,

// expose variables used in the classworlds configuration
System.setProperty("maven.home", m2Home.getPath());
System.setProperty("maven3.interceptor.common", (interceptorCommonJar != null ? interceptorCommonJar
: interceptorCommonJar).getPath());
System.setProperty("maven3.interceptor", (interceptorJar != null ? interceptorJar
: interceptorJar).getPath());

Expand Down Expand Up @@ -166,6 +154,21 @@ public void close() throws IOException {
System.exit(0);
}

/**
* Called by the code in remoting to add more plexus components.
* @since 1.3
*/
public static void addPlexusComponents(URL[] modules) {
try {
ClassRealm realm = launcher.getWorld().getRealm("plexus.core");
for (int i=0; i<modules.length; i++) {
realm.addURL(modules[i]);
}
} catch (NoSuchRealmException e) {
throw new Error(e);
}
}

/**
* Called by the code in remoting to launch.
*/
Expand Down
Expand Up @@ -23,17 +23,18 @@
*/
package org.jvnet.hudson.maven3.agent;

import java.io.OutputStream;
import java.io.IOException;
import java.io.FilterOutputStream;
import java.io.IOException;
import java.io.OutputStream;

/**
* JDK's {@link FilterOutputStream} has some real issues.
* JDK's {@link java.io.FilterOutputStream} has some real issues.
*
* @author Kohsuke Kawaguchi
*/
class RealFilterOutputStream extends FilterOutputStream {
public RealFilterOutputStream(OutputStream core) {
class RealFilterOutputStream
extends FilterOutputStream {
public RealFilterOutputStream( OutputStream core ) {
super(core);
}

Expand Down
Expand Up @@ -7,4 +7,5 @@ set maven.home default ${user.home}/m2

[plexus.core]
load ${maven3.interceptor}
load ${maven3.interceptor.common}
load ${maven.home}/lib/*.jar
52 changes: 52 additions & 0 deletions maven3-interceptor-commons/pom.xml
@@ -0,0 +1,52 @@
<?xml version="1.0"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jenkins-ci.main.maven</groupId>
<artifactId>maven-modules</artifactId>
<version>1.5-SNAPSHOT</version>
</parent>
<artifactId>maven3-interceptor-commons</artifactId>
<name>Jenkins Maven3 Interceptor Commons</name>

<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-core</artifactId>
<version>${maven3.0.x.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-embedder</artifactId>
<version>${maven3.0.x.version}</version>
</dependency>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-aether-provider</artifactId>
<version>${maven3.0.x.version}</version>
</dependency>

<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-component-metadata</artifactId>
<version>1.5.4</version>
<executions>
<execution>
<goals>
<goal>generate-metadata</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
@@ -1,6 +1,7 @@
package org.apache.maven.cli;

/*
* Copyright Olivier Lamy
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
Expand All @@ -21,16 +22,16 @@

import java.io.PrintStream;

import org.apache.maven.eventspy.EventSpy;
import org.apache.maven.execution.MavenExecutionRequest;
import org.apache.maven.execution.MavenExecutionRequestPopulationException;
import org.apache.maven.settings.building.SettingsBuildingException;

/**
* @author Olivier Lamy
* @since
*/
public interface MavenExecutionRequestBuilder
{
MavenExecutionRequest getMavenExecutionRequest( String[] args, PrintStream printStream )
MavenExecutionRequest getMavenExecutionRequest( String[] args, PrintStream printStream)
throws MavenExecutionRequestPopulationException, SettingsBuildingException, MavenExecutionRequestsBuilderException;
}
@@ -1,6 +1,7 @@
package org.apache.maven.cli;

/*
* Copyright Olivier Lamy
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
Expand Down
@@ -1,7 +1,7 @@
package org.jvnet.hudson.maven3.listeners;

/*
* Olivier Lamy
* Copyright Olivier Lamy
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
Expand Down Expand Up @@ -30,7 +30,6 @@

/**
* @author Olivier Lamy
* @since
*/
public class HudsonMavenExecutionResult implements Serializable
{
Expand Down

0 comments on commit 7005329

Please sign in to comment.