Skip to content

Commit

Permalink
Fixed issue: JENKINS-9693
Browse files Browse the repository at this point in the history
Removed the call to request.getProjectBuildingRequest() because this  call creates a new ProjectBuildingRequest object and set's the BuildStartTime null.
Maven takes care of this by it self later.

Modified repository location in the pom.xml.
  • Loading branch information
rbierman committed Jul 3, 2013
1 parent a442fc8 commit 021aba7
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 23 deletions.
26 changes: 23 additions & 3 deletions maven-agent/src/main/java/hudson/maven/agent/Main.java
Expand Up @@ -31,8 +31,9 @@
import java.io.InputStream;
import java.io.OutputStream;
import java.lang.reflect.InvocationTargetException;
import java.net.Socket;
import java.net.InetAddress;
import java.net.Socket;
import java.net.URL;
import java.util.HashSet;
import java.util.Iterator;
import java.util.Set;
Expand All @@ -58,11 +59,30 @@ 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;

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 @@ -101,7 +121,7 @@ public static void main(File m2Home, File remotingJar, File interceptorJar, int
// I don't know how classworlds react to undefined variable, so
(interceptorOverrideJar!=null?interceptorOverrideJar:interceptorJar).getPath());

boolean is206OrLater = !new File(m2Home,"core").exists();
is206OrLater = !new File(m2Home,"core").exists();

// load the default realms
launcher = new Launcher();
Expand Down
Expand Up @@ -34,9 +34,11 @@
import java.io.OutputStream;
import java.net.Socket;
import java.net.InetAddress;
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;



Expand All @@ -58,6 +60,21 @@ 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 {
main(new File(args[0]), new File(args[1]),new File(args[2]),
Expand Down
Expand Up @@ -89,8 +89,6 @@ public class DefaultMavenExecutionRequestBuilder

private DefaultSecDispatcher dispatcher;

static final String DEFAULT_BUILD_TIMESTAMP_FORMAT = "yyyyMMdd-HHmm";

public void initialize()
throws InitializationException
{
Expand Down Expand Up @@ -128,18 +126,6 @@ public MavenExecutionRequest getMavenExecutionRequest( String[] args, PrintStrea
encryption( cliRequest );

MavenExecutionRequest request = executionRequestPopulator.populateDefaults( cliRequest.request );

// TODO move this in ASF sources ?

if (request.getProjectBuildingRequest().getRepositorySession()== null)
{
MavenRepositorySystemSession session = new MavenRepositorySystemSession();
if (session.getLocalRepositoryManager() == null)
{
session.setLocalRepositoryManager( new EnhancedLocalRepositoryManager( request.getLocalRepositoryPath() ) );
}
request.getProjectBuildingRequest().setRepositorySession( session );
}

return request;
}
Expand Down Expand Up @@ -346,7 +332,6 @@ static void populateProperties( CommandLine commandLine, Properties systemProper
}

systemProperties.putAll( System.getProperties() );
systemProperties.put( "maven.build.timestamp", new SimpleDateFormat(DEFAULT_BUILD_TIMESTAMP_FORMAT).format( new Date() ) );
}

private static void setCliProperty( String property, Properties properties )
Expand Down
9 changes: 4 additions & 5 deletions pom.xml
Expand Up @@ -275,8 +275,8 @@ THE SOFTWARE.

<repositories>
<repository>
<id>m.g.o-public</id>
<url>http://maven.jenkins-ci.org:8081/content/groups/artifacts/</url>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
<releases>
<enabled>true</enabled>
</releases>
Expand All @@ -285,11 +285,10 @@ THE SOFTWARE.
</snapshots>
</repository>
</repositories>

<pluginRepositories>
<pluginRepository>
<id>m.g.o-public</id>
<url>http://maven.jenkins-ci.org:8081/content/groups/artifacts/</url>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
<releases>
<enabled>true</enabled>
</releases>
Expand Down

0 comments on commit 021aba7

Please sign in to comment.