2004-07-25 23:53:12 -04:00
|
|
|
|
2005-03-09 20:35:25 -05:00
|
|
|
import compile.CompilerConfiguration;
|
|
|
|
import compile.JavacCompiler;
|
|
|
|
import download.ArtifactDownloader;
|
|
|
|
import jar.JarMojo;
|
2005-04-03 21:36:58 -04:00
|
|
|
import model.Dependency;
|
|
|
|
import model.ModelReader;
|
2005-04-04 01:08:45 -04:00
|
|
|
import model.Repository;
|
2004-07-25 23:53:12 -04:00
|
|
|
import org.xml.sax.Attributes;
|
|
|
|
import org.xml.sax.SAXException;
|
2004-12-04 23:12:25 -05:00
|
|
|
import test.SurefirePlugin;
|
2005-04-03 21:36:58 -04:00
|
|
|
import util.AbstractReader;
|
2004-12-04 23:12:25 -05:00
|
|
|
import util.Commandline;
|
|
|
|
import util.FileUtils;
|
2005-03-31 05:54:32 -05:00
|
|
|
import util.IOUtil;
|
2004-12-04 23:12:25 -05:00
|
|
|
import util.IsolatedClassLoader;
|
|
|
|
import util.Os;
|
2004-07-25 23:53:12 -04:00
|
|
|
|
|
|
|
import java.io.File;
|
2004-08-15 00:30:20 -04:00
|
|
|
import java.io.FileNotFoundException;
|
2005-03-31 05:54:32 -05:00
|
|
|
import java.io.FileWriter;
|
2005-04-04 01:08:45 -04:00
|
|
|
import java.io.IOException;
|
2005-03-31 05:54:32 -05:00
|
|
|
import java.io.StringReader;
|
2005-03-07 14:03:19 -05:00
|
|
|
import java.lang.reflect.InvocationTargetException;
|
2004-07-25 23:53:12 -04:00
|
|
|
import java.lang.reflect.Method;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
2005-04-04 10:35:06 -04:00
|
|
|
import java.util.Collection;
|
2005-03-09 17:13:07 -05:00
|
|
|
import java.util.Collections;
|
2004-10-23 09:31:15 -04:00
|
|
|
import java.util.Date;
|
2004-07-25 23:53:12 -04:00
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
2005-03-09 17:13:07 -05:00
|
|
|
import java.util.Map;
|
|
|
|
import java.util.TreeMap;
|
2004-07-25 23:53:12 -04:00
|
|
|
|
|
|
|
public class MBoot
|
|
|
|
{
|
2005-03-17 18:59:07 -05:00
|
|
|
String[] builds = new String[]{"maven-model", "maven-settings", "maven-monitor", "maven-plugin", "maven-artifact",
|
|
|
|
"maven-script/maven-script-marmalade", "maven-core", "maven-archiver",
|
|
|
|
"maven-plugin-tools/maven-plugin-tools-api",
|
2005-03-09 20:35:25 -05:00
|
|
|
"maven-plugin-tools/maven-plugin-tools-java",
|
|
|
|
"maven-plugin-tools/maven-plugin-tools-pluggy",
|
2005-03-17 18:59:07 -05:00
|
|
|
"maven-plugin-tools/maven-plugin-tools-marmalade", "maven-core-it-verifier"};
|
2005-03-09 20:35:25 -05:00
|
|
|
|
2005-03-31 23:44:33 -05:00
|
|
|
String[] pluginBuilds = new String[]{"maven-plugins/maven-clean-plugin", "maven-plugins/maven-compiler-plugin",
|
2005-04-03 21:36:58 -04:00
|
|
|
"maven-plugins/maven-install-plugin", "maven-plugins/maven-jar-plugin",
|
|
|
|
"maven-plugins/maven-plugin-plugin", "maven-plugins/maven-resources-plugin",
|
|
|
|
"maven-plugins/maven-surefire-plugin"};
|
2005-04-03 20:12:56 -04:00
|
|
|
|
2005-03-09 17:13:07 -05:00
|
|
|
private static final Map MODELLO_TARGET_VERSIONS;
|
2005-03-09 20:35:25 -05:00
|
|
|
|
2005-03-09 17:13:07 -05:00
|
|
|
private static final Map MODELLO_MODEL_FILES;
|
2005-03-09 20:35:25 -05:00
|
|
|
|
2005-03-09 17:13:07 -05:00
|
|
|
static
|
|
|
|
{
|
|
|
|
Map targetVersions = new TreeMap();
|
|
|
|
targetVersions.put( "maven-model", "4.0.0" );
|
2005-03-16 01:29:35 -05:00
|
|
|
targetVersions.put( "maven-settings", "1.0.0" );
|
2005-03-09 20:35:25 -05:00
|
|
|
|
2005-03-09 17:13:07 -05:00
|
|
|
MODELLO_TARGET_VERSIONS = Collections.unmodifiableMap( targetVersions );
|
2005-03-09 20:35:25 -05:00
|
|
|
|
2005-03-09 17:13:07 -05:00
|
|
|
Map modelFiles = new TreeMap();
|
|
|
|
modelFiles.put( "maven-model", "maven.mdo" );
|
2005-03-16 01:29:35 -05:00
|
|
|
modelFiles.put( "maven-settings", "settings.mdo" );
|
2005-03-09 20:35:25 -05:00
|
|
|
|
2005-03-09 17:13:07 -05:00
|
|
|
MODELLO_MODEL_FILES = Collections.unmodifiableMap( modelFiles );
|
|
|
|
}
|
2004-08-09 14:57:50 -04:00
|
|
|
|
2004-07-25 23:53:12 -04:00
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// Standard locations for resources in Maven projects.
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
|
|
|
private static final String SOURCES = "src/main/java";
|
|
|
|
|
|
|
|
private static final String TEST_SOURCES = "src/test/java";
|
|
|
|
|
|
|
|
private static final String RESOURCES = "src/main/resources";
|
|
|
|
|
|
|
|
private static final String TEST_RESOURCES = "src/test/resources";
|
|
|
|
|
2004-08-20 20:14:25 -04:00
|
|
|
private static final String BUILD_DIR = "target";
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-08-20 20:14:25 -04:00
|
|
|
private static final String CLASSES = BUILD_DIR + "/classes";
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-08-20 20:14:25 -04:00
|
|
|
private static final String TEST_CLASSES = BUILD_DIR + "/test-classes";
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-08-20 20:14:25 -04:00
|
|
|
private static final String GENERATED_SOURCES = BUILD_DIR + "/generated-sources";
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-09-27 08:49:54 -04:00
|
|
|
private static final String GENERATED_DOCS = BUILD_DIR + "/generated-docs";
|
|
|
|
|
2004-07-25 23:53:12 -04:00
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// Per-session entities which we can reuse while building many projects.
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
|
|
|
private ArtifactDownloader downloader;
|
|
|
|
|
2004-07-27 12:59:04 -04:00
|
|
|
private boolean online = true;
|
|
|
|
|
2005-04-03 22:01:49 -04:00
|
|
|
private static final String SCOPE_TEST = "test";
|
|
|
|
|
|
|
|
private static final String SCOPE_COMPILE = "compile";
|
|
|
|
|
|
|
|
private static final String SCOPE_RUNTIME = "runtime";
|
|
|
|
|
2004-07-25 23:53:12 -04:00
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
//
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
2005-03-09 20:35:25 -05:00
|
|
|
public static void main( String[] args )
|
|
|
|
throws Exception
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
2005-03-07 14:03:19 -05:00
|
|
|
try
|
|
|
|
{
|
|
|
|
MBoot mboot = new MBoot();
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-03-07 14:03:19 -05:00
|
|
|
mboot.run( args );
|
|
|
|
}
|
|
|
|
catch ( InvocationTargetException e )
|
|
|
|
{
|
|
|
|
Throwable target = e.getTargetException();
|
2005-03-09 17:13:07 -05:00
|
|
|
|
|
|
|
if ( target instanceof RuntimeException )
|
2005-03-07 14:03:19 -05:00
|
|
|
{
|
2005-03-09 17:13:07 -05:00
|
|
|
throw (RuntimeException) target;
|
2005-03-07 14:03:19 -05:00
|
|
|
}
|
2005-03-09 17:13:07 -05:00
|
|
|
else if ( target instanceof Exception )
|
2005-03-07 14:03:19 -05:00
|
|
|
{
|
2005-03-09 17:13:07 -05:00
|
|
|
throw (Exception) target;
|
2005-03-07 14:03:19 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-03-09 17:13:07 -05:00
|
|
|
throw new RuntimeException( target );
|
2005-03-07 14:03:19 -05:00
|
|
|
}
|
|
|
|
}
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
|
2005-03-09 20:35:25 -05:00
|
|
|
public void run( String[] args )
|
|
|
|
throws Exception
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
2004-12-23 18:46:42 -05:00
|
|
|
String mavenRepoLocal = System.getProperty( "maven.repo.local" );
|
|
|
|
|
2005-03-17 15:20:49 -05:00
|
|
|
SettingsReader userModelReader = new SettingsReader();
|
2005-03-17 01:11:17 -05:00
|
|
|
|
2004-12-23 18:46:42 -05:00
|
|
|
if ( mavenRepoLocal == null )
|
2004-09-02 08:50:46 -04:00
|
|
|
{
|
2004-12-23 18:46:42 -05:00
|
|
|
try
|
|
|
|
{
|
|
|
|
String userHome = System.getProperty( "user.home" );
|
2004-09-02 08:50:46 -04:00
|
|
|
|
2005-03-16 01:29:35 -05:00
|
|
|
File settingsXml = new File( userHome, ".m2/settings.xml" );
|
2005-03-09 20:35:25 -05:00
|
|
|
|
2005-03-16 01:29:35 -05:00
|
|
|
if ( settingsXml.exists() )
|
2005-03-10 11:35:04 -05:00
|
|
|
{
|
2005-03-16 01:29:35 -05:00
|
|
|
userModelReader.parse( settingsXml );
|
2004-12-23 18:46:42 -05:00
|
|
|
|
2005-03-17 01:11:17 -05:00
|
|
|
Profile activeProfile = userModelReader.getActiveProfile();
|
2005-03-10 11:35:04 -05:00
|
|
|
|
|
|
|
mavenRepoLocal = new File( activeProfile.getLocalRepo() ).getAbsolutePath();
|
|
|
|
}
|
2004-12-23 18:46:42 -05:00
|
|
|
}
|
|
|
|
catch ( Exception e )
|
|
|
|
{
|
2005-03-09 17:13:07 -05:00
|
|
|
e.printStackTrace();
|
2004-12-23 18:46:42 -05:00
|
|
|
}
|
|
|
|
}
|
2004-09-02 08:50:46 -04:00
|
|
|
|
|
|
|
if ( mavenRepoLocal == null )
|
2004-07-26 21:19:41 -04:00
|
|
|
{
|
2005-03-10 11:35:04 -05:00
|
|
|
String userHome = System.getProperty( "user.home" );
|
|
|
|
String m2LocalRepoPath = "/.m2/repository";
|
|
|
|
|
|
|
|
File repoDir = new File( userHome, m2LocalRepoPath );
|
|
|
|
if ( !repoDir.exists() )
|
|
|
|
{
|
|
|
|
repoDir.mkdirs();
|
|
|
|
}
|
|
|
|
|
|
|
|
mavenRepoLocal = repoDir.getAbsolutePath();
|
|
|
|
|
2005-03-17 18:59:07 -05:00
|
|
|
System.out.println(
|
|
|
|
"You SHOULD have a ~/.m2/settings.xml file and must contain at least the following information:" );
|
|
|
|
System.out.println();
|
2005-03-10 11:35:04 -05:00
|
|
|
|
2005-03-17 18:59:07 -05:00
|
|
|
System.out.println( "<settings>" );
|
|
|
|
System.out.println( " <profiles>" );
|
|
|
|
System.out.println( " <profile>" );
|
|
|
|
System.out.println( " <active>true</active>" );
|
|
|
|
System.out.println( " <localRepository>/path/to/your/repository</localRepository>" );
|
|
|
|
System.out.println( " </profile>" );
|
|
|
|
System.out.println( " </profiles>" );
|
|
|
|
System.out.println( "</settings>" );
|
2004-12-23 18:46:42 -05:00
|
|
|
|
2004-09-02 08:50:46 -04:00
|
|
|
System.out.println();
|
2004-12-23 18:46:42 -05:00
|
|
|
|
2004-09-02 08:50:46 -04:00
|
|
|
System.out.println( "Alternatively, you can specify -Dmaven.repo.local=/path/to/m2/repository" );
|
2004-07-26 21:19:41 -04:00
|
|
|
|
2005-03-10 11:35:04 -05:00
|
|
|
System.out.println();
|
|
|
|
|
2005-03-17 18:59:07 -05:00
|
|
|
System.out.println( "HOWEVER, since you did not specify a repository path, maven will use: " +
|
|
|
|
repoDir.getAbsolutePath() + " to store artifacts locally." );
|
2004-07-26 21:19:41 -04:00
|
|
|
}
|
2005-04-04 01:08:45 -04:00
|
|
|
|
|
|
|
File repoLocalFile = new File( mavenRepoLocal );
|
|
|
|
repoLocalFile.mkdirs();
|
|
|
|
|
|
|
|
if ( !repoLocalFile.canWrite() )
|
|
|
|
{
|
|
|
|
System.err.println( "Can't write to " + mavenRepoLocal );
|
|
|
|
|
|
|
|
System.exit( 1 );
|
|
|
|
}
|
2004-07-26 21:19:41 -04:00
|
|
|
|
2004-09-02 08:34:19 -04:00
|
|
|
String mavenHome = null;
|
2004-07-26 18:45:09 -04:00
|
|
|
|
2004-09-02 08:34:19 -04:00
|
|
|
if ( args.length == 1 )
|
|
|
|
{
|
|
|
|
mavenHome = args[0];
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
mavenHome = System.getProperty( "maven.home" );
|
|
|
|
|
|
|
|
if ( mavenHome == null )
|
|
|
|
{
|
|
|
|
mavenHome = new File( System.getProperty( "user.home" ), "m2" ).getAbsolutePath();
|
|
|
|
}
|
|
|
|
}
|
2004-07-26 18:45:09 -04:00
|
|
|
|
2004-09-02 08:34:19 -04:00
|
|
|
File dist = new File( mavenHome );
|
2004-07-26 21:19:41 -04:00
|
|
|
|
2004-09-02 08:34:19 -04:00
|
|
|
System.out.println( "Maven installation directory: " + dist );
|
2004-08-14 16:46:24 -04:00
|
|
|
|
2004-09-02 08:34:19 -04:00
|
|
|
Date fullStop;
|
2004-07-26 21:19:41 -04:00
|
|
|
|
2004-09-02 08:34:19 -04:00
|
|
|
Date fullStart = new Date();
|
2004-07-27 12:59:04 -04:00
|
|
|
|
2004-12-23 18:46:42 -05:00
|
|
|
String onlineProperty = System.getProperty( "maven.online" );
|
2004-07-27 12:59:04 -04:00
|
|
|
|
|
|
|
if ( onlineProperty != null && onlineProperty.equals( "false" ) )
|
|
|
|
{
|
|
|
|
online = false;
|
2004-07-26 21:19:41 -04:00
|
|
|
}
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-04 02:47:21 -04:00
|
|
|
Repository localRepository = new Repository( mavenRepoLocal, Repository.LAYOUT_DEFAULT );
|
2005-04-04 01:08:45 -04:00
|
|
|
|
2005-04-03 21:36:58 -04:00
|
|
|
if ( online )
|
2005-03-17 01:11:17 -05:00
|
|
|
{
|
2005-04-04 10:35:06 -04:00
|
|
|
downloader = new ArtifactDownloader( localRepository, Collections.EMPTY_LIST );
|
2005-04-03 21:36:58 -04:00
|
|
|
if ( userModelReader.getActiveProxy() != null )
|
|
|
|
{
|
|
|
|
Proxy proxy = userModelReader.getActiveProxy();
|
|
|
|
downloader.setProxy( proxy.getHost(), proxy.getPort(), proxy.getUserName(), proxy.getPassword() );
|
|
|
|
}
|
2005-03-17 01:11:17 -05:00
|
|
|
}
|
2004-07-25 23:53:12 -04:00
|
|
|
|
|
|
|
String basedir = System.getProperty( "user.dir" );
|
|
|
|
|
2004-07-26 21:19:41 -04:00
|
|
|
// Install maven-components POM
|
2005-04-04 01:08:45 -04:00
|
|
|
installPomFile( localRepository, new File( basedir, "pom.xml" ) );
|
2004-07-26 18:45:09 -04:00
|
|
|
|
2004-07-26 21:19:41 -04:00
|
|
|
// Install plugin-parent POM
|
2005-04-04 01:08:45 -04:00
|
|
|
installPomFile( localRepository, new File( basedir, "maven-plugins/pom.xml" ) );
|
2004-07-26 18:45:09 -04:00
|
|
|
|
2005-03-10 02:35:38 -05:00
|
|
|
// Install plugin-tools-parent POM
|
2005-04-04 01:08:45 -04:00
|
|
|
installPomFile( localRepository, new File( basedir, "maven-plugin-tools/pom.xml" ) );
|
2005-02-20 12:50:05 -05:00
|
|
|
|
2005-03-10 02:35:38 -05:00
|
|
|
// Install maven-script-parent POM
|
2005-04-04 01:08:45 -04:00
|
|
|
installPomFile( localRepository, new File( basedir, "maven-script/pom.xml" ) );
|
2005-03-10 02:35:38 -05:00
|
|
|
|
2005-03-15 16:35:06 -05:00
|
|
|
// Install it-support POM
|
2005-04-04 01:08:45 -04:00
|
|
|
installPomFile( localRepository, new File( basedir, "maven-core-it-support/pom.xml" ) );
|
|
|
|
|
2005-04-04 10:35:06 -04:00
|
|
|
ModelReader reader = new ModelReader( downloader, true );
|
2005-04-04 01:23:01 -04:00
|
|
|
|
|
|
|
reader.parse( new File( basedir, "maven-mboot2/pom.xml" ) );
|
|
|
|
|
|
|
|
ClassLoader bootstrapClassLoader = createClassloaderFromDependencies( reader.getDependencies(), null,
|
|
|
|
localRepository );
|
|
|
|
|
2005-04-04 11:02:03 -04:00
|
|
|
reader = new ModelReader( downloader, false );
|
2005-04-04 01:23:01 -04:00
|
|
|
reader.parse( new File( basedir, "maven-plugins/maven-surefire-plugin/pom.xml" ) );
|
2005-04-04 01:31:29 -04:00
|
|
|
List surefireDependencies = new ArrayList();
|
|
|
|
|
|
|
|
// TODO: while we have maven-artifact in there, it needs to be filtered...
|
|
|
|
for ( Iterator i = reader.getDependencies().iterator(); i.hasNext(); )
|
|
|
|
{
|
|
|
|
Dependency d = (Dependency) i.next();
|
2005-04-04 01:41:57 -04:00
|
|
|
if ( d.getGroupId().equals( "surefire" ) || d.getGroupId().equals( "junit" ) )
|
2005-04-04 01:31:29 -04:00
|
|
|
{
|
|
|
|
surefireDependencies.add( d );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( online )
|
|
|
|
{
|
|
|
|
downloader.downloadDependencies( surefireDependencies );
|
|
|
|
}
|
2005-04-04 01:23:01 -04:00
|
|
|
|
2005-04-04 10:35:06 -04:00
|
|
|
reader = new ModelReader( downloader, true );
|
2005-04-04 01:23:01 -04:00
|
|
|
|
2005-04-04 10:35:06 -04:00
|
|
|
Collection coreDeps = null;
|
2005-04-04 01:08:45 -04:00
|
|
|
Dependency corePom = null;
|
2005-03-15 16:35:06 -05:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
for ( int i = 0; i < builds.length; i++ )
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
2004-07-26 18:02:58 -04:00
|
|
|
String directory = new File( basedir, builds[i] ).getAbsolutePath();
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
System.out.println( "Building project in " + directory + " ..." );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
System.out.println( "--------------------------------------------------------------------" );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
System.setProperty( "basedir", directory );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
reader = buildProject( directory, builds[i], bootstrapClassLoader, surefireDependencies, localRepository );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-03 21:36:58 -04:00
|
|
|
if ( reader.getArtifactId().equals( "maven-core" ) )
|
2004-07-26 18:02:58 -04:00
|
|
|
{
|
|
|
|
coreDeps = reader.getDependencies();
|
2005-04-04 01:08:45 -04:00
|
|
|
corePom = new Dependency( reader.getGroupId(), reader.getArtifactId(), reader.getVersion(),
|
|
|
|
reader.getPackaging() );
|
2004-07-26 18:02:58 -04:00
|
|
|
}
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
System.out.println( "--------------------------------------------------------------------" );
|
|
|
|
}
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-04 10:35:06 -04:00
|
|
|
reader = new ModelReader( downloader, true );
|
2005-04-03 22:31:56 -04:00
|
|
|
reader.parse( new File( basedir, "maven-plugin-tools/maven-plugin-tools-pluggy/pom.xml" ) );
|
|
|
|
List dependencies = new ArrayList( reader.getDependencies() );
|
2005-04-04 01:08:45 -04:00
|
|
|
dependencies.add(
|
|
|
|
new Dependency( reader.getGroupId(), reader.getArtifactId(), reader.getVersion(), reader.getPackaging() ) );
|
|
|
|
IsolatedClassLoader cl = createClassloaderFromDependencies( dependencies, bootstrapClassLoader,
|
|
|
|
localRepository );
|
2005-02-24 00:12:30 -05:00
|
|
|
|
2004-08-09 14:57:50 -04:00
|
|
|
for ( int i = 0; i < pluginBuilds.length; i++ )
|
|
|
|
{
|
|
|
|
String directory = new File( basedir, pluginBuilds[i] ).getAbsolutePath();
|
|
|
|
|
|
|
|
System.out.println( "Building project in " + directory + " ..." );
|
|
|
|
|
|
|
|
System.out.println( "--------------------------------------------------------------------" );
|
|
|
|
|
|
|
|
System.setProperty( "basedir", directory );
|
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
reader = buildProject( directory, pluginBuilds[i], cl, surefireDependencies, localRepository );
|
2004-08-09 14:57:50 -04:00
|
|
|
|
|
|
|
System.out.println( "--------------------------------------------------------------------" );
|
|
|
|
}
|
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
// build the installation
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
FileUtils.deleteDirectory( dist );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// bin
|
|
|
|
// ----------------------------------------------------------------------
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
String bin = new File( dist, "bin" ).getAbsolutePath();
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
FileUtils.mkdir( new File( bin ).getPath() );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
FileUtils.copyFileToDirectory( new File( basedir, "maven-core/src/bin/m2" ).getAbsolutePath(), bin );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
FileUtils.copyFileToDirectory( new File( basedir, "maven-core/src/bin/m2.bat" ).getAbsolutePath(), bin );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-12-04 23:12:25 -05:00
|
|
|
FileUtils.copyFileToDirectory( new File( basedir, "maven-core/src/bin/m2.conf" ).getAbsolutePath(), bin );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
if ( Os.isFamily( "unix" ) )
|
|
|
|
{
|
|
|
|
Commandline cli = new Commandline();
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
cli.setExecutable( "chmod" );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
cli.createArgument().setValue( "+x" );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
cli.createArgument().setValue( new File( dist, "bin/m2" ).getAbsolutePath() );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-04 17:26:20 -04:00
|
|
|
cli.execute().waitFor();
|
2004-07-26 18:02:58 -04:00
|
|
|
}
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// core
|
|
|
|
// ----------------------------------------------------------------------
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-03 21:36:58 -04:00
|
|
|
File core = new File( dist, "core" );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-03 21:36:58 -04:00
|
|
|
core.mkdirs();
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-03 21:36:58 -04:00
|
|
|
File boot = new File( dist, "core/boot" );
|
2004-10-23 09:31:15 -04:00
|
|
|
|
2005-04-03 21:36:58 -04:00
|
|
|
boot.mkdirs();
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// lib
|
|
|
|
// ----------------------------------------------------------------------
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-04 10:35:06 -04:00
|
|
|
// TODO: check this - we are transitively including in /lib...
|
2005-04-03 21:36:58 -04:00
|
|
|
File lib = new File( dist, "lib" );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-03 21:36:58 -04:00
|
|
|
lib.mkdirs();
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
for ( Iterator i = coreDeps.iterator(); i.hasNext(); )
|
|
|
|
{
|
|
|
|
Dependency d = (Dependency) i.next();
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
File source = localRepository.getArtifactFile( d );
|
2005-04-03 21:36:58 -04:00
|
|
|
if ( d.getArtifactId().equals( "classworlds" ) )
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
2005-04-03 21:36:58 -04:00
|
|
|
FileUtils.copyFileToDirectory( source, boot );
|
|
|
|
}
|
|
|
|
else if ( d.getArtifactId().equals( "plexus-container-default" ) )
|
|
|
|
{
|
|
|
|
FileUtils.copyFileToDirectory( source, core );
|
|
|
|
}
|
2005-04-04 10:35:06 -04:00
|
|
|
else if ( !d.getScope().equals( SCOPE_TEST ) && !d.getArtifactId().equals( "plexus-utils" ) )
|
2005-04-03 21:36:58 -04:00
|
|
|
{
|
2005-04-04 10:35:06 -04:00
|
|
|
// only compile and runtime
|
2005-04-03 21:36:58 -04:00
|
|
|
FileUtils.copyFileToDirectory( source, lib );
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
2004-07-26 18:02:58 -04:00
|
|
|
}
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-26 18:02:58 -04:00
|
|
|
// Copy maven itself
|
2005-04-04 01:08:45 -04:00
|
|
|
FileUtils.copyFileToDirectory( localRepository.getArtifactFile( corePom ), lib );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-09-07 08:08:48 -04:00
|
|
|
System.out.println();
|
|
|
|
|
|
|
|
System.out.println( "Maven2 is installed in " + dist.getAbsolutePath() );
|
|
|
|
|
|
|
|
System.out.println( "--------------------------------------------------------------------" );
|
|
|
|
|
|
|
|
System.out.println();
|
|
|
|
|
2004-07-26 18:45:09 -04:00
|
|
|
fullStop = new Date();
|
|
|
|
|
|
|
|
stats( fullStart, fullStop );
|
|
|
|
}
|
|
|
|
|
|
|
|
protected static String formatTime( long ms )
|
|
|
|
{
|
|
|
|
long secs = ms / 1000;
|
|
|
|
|
|
|
|
long min = secs / 60;
|
|
|
|
secs = secs % 60;
|
|
|
|
|
|
|
|
if ( min > 0 )
|
|
|
|
{
|
|
|
|
return min + " minutes " + secs + " seconds";
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return secs + " seconds";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private void stats( Date fullStart, Date fullStop )
|
|
|
|
{
|
|
|
|
long fullDiff = fullStop.getTime() - fullStart.getTime();
|
|
|
|
|
|
|
|
System.out.println( "Total time: " + formatTime( fullDiff ) );
|
|
|
|
|
|
|
|
System.out.println( "Finished at: " + fullStop );
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
private ModelReader buildProject( String basedir, String projectId, ClassLoader classLoader,
|
|
|
|
List surefireDependencies, Repository localRepository )
|
2005-03-09 20:35:25 -05:00
|
|
|
throws Exception
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
|
|
|
System.out.println( "Building project in " + basedir );
|
|
|
|
|
2005-04-04 10:35:06 -04:00
|
|
|
ModelReader reader = new ModelReader( downloader, true );
|
2005-03-23 01:52:55 -05:00
|
|
|
|
2005-04-04 01:23:01 -04:00
|
|
|
reader.parse( new File( basedir, "pom.xml" ) );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
|
|
|
String sources = new File( basedir, SOURCES ).getAbsolutePath();
|
|
|
|
|
|
|
|
String resources = new File( basedir, RESOURCES ).getAbsolutePath();
|
|
|
|
|
|
|
|
String classes = new File( basedir, CLASSES ).getAbsolutePath();
|
|
|
|
|
|
|
|
String testSources = new File( basedir, TEST_SOURCES ).getAbsolutePath();
|
|
|
|
|
|
|
|
String testResources = new File( basedir, TEST_RESOURCES ).getAbsolutePath();
|
|
|
|
|
|
|
|
String testClasses = new File( basedir, TEST_CLASSES ).getAbsolutePath();
|
|
|
|
|
|
|
|
String generatedSources = new File( basedir, GENERATED_SOURCES ).getAbsolutePath();
|
|
|
|
|
2004-08-20 20:14:25 -04:00
|
|
|
File buildDirFile = new File( basedir, BUILD_DIR );
|
|
|
|
String buildDir = buildDirFile.getAbsolutePath();
|
|
|
|
|
|
|
|
// clean
|
|
|
|
System.out.println( "Cleaning " + buildDirFile + "..." );
|
2004-08-26 07:50:39 -04:00
|
|
|
FileUtils.forceDelete( buildDirFile );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-07-27 12:59:04 -04:00
|
|
|
if ( online )
|
|
|
|
{
|
2005-04-03 22:01:49 -04:00
|
|
|
System.out.println( "Downloading project dependencies ..." );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-03 21:36:58 -04:00
|
|
|
downloader.downloadDependencies( reader.getDependencies() );
|
2004-07-27 12:59:04 -04:00
|
|
|
}
|
2004-07-25 23:53:12 -04:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// Generating sources
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
2005-03-09 17:13:07 -05:00
|
|
|
File base = new File( basedir );
|
2005-03-09 20:35:25 -05:00
|
|
|
|
|
|
|
String modelFileName = (String) MODELLO_MODEL_FILES.get( projectId );
|
|
|
|
|
2005-03-08 01:06:22 -05:00
|
|
|
File model = null;
|
2005-03-09 20:35:25 -05:00
|
|
|
if ( modelFileName != null && modelFileName.trim().length() > 0 )
|
2005-03-08 01:06:22 -05:00
|
|
|
{
|
2005-03-09 20:35:25 -05:00
|
|
|
model = new File( base, modelFileName );
|
2005-03-08 01:06:22 -05:00
|
|
|
}
|
2005-03-09 20:35:25 -05:00
|
|
|
|
2005-03-08 01:06:22 -05:00
|
|
|
if ( model != null && model.exists() )
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
|
|
|
System.out.println( "Model exists!" );
|
|
|
|
|
2005-03-09 20:35:25 -05:00
|
|
|
String modelVersion = (String) MODELLO_TARGET_VERSIONS.get( projectId );
|
|
|
|
if ( modelVersion == null || modelVersion.trim().length() < 1 )
|
2005-03-09 17:13:07 -05:00
|
|
|
{
|
2005-03-09 20:35:25 -05:00
|
|
|
System.out.println( "No model version configured. Using \'1.0.0\'..." );
|
2005-03-09 17:13:07 -05:00
|
|
|
modelVersion = "1.0.0";
|
|
|
|
}
|
2005-03-09 20:35:25 -05:00
|
|
|
|
2004-08-20 20:14:25 -04:00
|
|
|
File generatedSourcesDirectory = new File( basedir, GENERATED_SOURCES );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
|
|
|
if ( !generatedSourcesDirectory.exists() )
|
|
|
|
{
|
|
|
|
generatedSourcesDirectory.mkdirs();
|
|
|
|
}
|
|
|
|
|
2004-09-27 08:49:54 -04:00
|
|
|
File generatedDocsDirectory = new File( basedir, GENERATED_DOCS );
|
|
|
|
|
|
|
|
if ( !generatedDocsDirectory.exists() )
|
|
|
|
{
|
|
|
|
generatedDocsDirectory.mkdirs();
|
|
|
|
}
|
2005-03-09 20:35:25 -05:00
|
|
|
|
|
|
|
System.out.println(
|
|
|
|
"Generating model bindings for version \'" + modelVersion + "\' in project: " + projectId );
|
|
|
|
|
2005-04-03 22:31:56 -04:00
|
|
|
generateSources( model.getAbsolutePath(), "java", generatedSources, modelVersion, "false", classLoader );
|
2005-04-03 21:36:58 -04:00
|
|
|
generateSources( model.getAbsolutePath(), "xpp3-reader", generatedSources, modelVersion, "false",
|
2005-04-03 22:31:56 -04:00
|
|
|
classLoader );
|
2005-04-03 21:36:58 -04:00
|
|
|
generateSources( model.getAbsolutePath(), "xpp3-writer", generatedSources, modelVersion, "false",
|
2005-04-03 22:31:56 -04:00
|
|
|
classLoader );
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// Standard compile
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
|
|
|
System.out.println( "Compiling sources ..." );
|
|
|
|
|
|
|
|
if ( new File( generatedSources ).exists() )
|
|
|
|
{
|
2005-04-04 01:08:45 -04:00
|
|
|
compile( reader.getDependencies(), sources, classes, null, generatedSources, SCOPE_COMPILE,
|
|
|
|
localRepository );
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-04-04 01:08:45 -04:00
|
|
|
compile( reader.getDependencies(), sources, classes, null, null, SCOPE_COMPILE, localRepository );
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// Plugin descriptor generation
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
2005-04-03 21:36:58 -04:00
|
|
|
if ( reader.getPackaging().equals( "maven-plugin" ) )
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
|
|
|
System.out.println( "Generating maven plugin descriptor ..." );
|
|
|
|
|
2005-03-09 17:13:07 -05:00
|
|
|
generatePluginDescriptor( sources, new File( classes, "META-INF/maven" ).getAbsolutePath(),
|
2005-04-04 01:08:45 -04:00
|
|
|
new File( basedir, "pom.xml" ).getAbsolutePath(), classLoader, localRepository );
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// Standard resources
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
|
|
|
System.out.println( "Packaging resources ..." );
|
|
|
|
|
|
|
|
copyResources( resources, classes );
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// Test compile
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
|
|
|
System.out.println( "Compiling test sources ..." );
|
|
|
|
|
2005-04-05 00:11:03 -04:00
|
|
|
Collection testDependencies = new ArrayList( reader.getDependencies() );
|
2004-07-27 07:13:06 -04:00
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
compile( testDependencies, testSources, testClasses, classes, null, SCOPE_TEST, localRepository );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// Test resources
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
|
|
|
System.out.println( "Packaging test resources ..." );
|
|
|
|
|
|
|
|
copyResources( testResources, testClasses );
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// Run tests
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
runTests( basedir, classes, testClasses, reader, surefireDependencies, localRepository );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// Create JAR
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
2005-03-23 01:52:55 -05:00
|
|
|
createJar( classes, buildDir, reader );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
installPom( basedir, localRepository, reader );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-03 21:36:58 -04:00
|
|
|
String artifactId = reader.getArtifactId();
|
|
|
|
|
|
|
|
if ( !artifactId.equals( "maven-plugin" ) && artifactId.endsWith( "plugin" ) )
|
2004-08-09 14:57:50 -04:00
|
|
|
{
|
2005-04-04 01:08:45 -04:00
|
|
|
install( basedir, localRepository, reader, "maven-plugin" );
|
2004-08-09 14:57:50 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-04-04 01:08:45 -04:00
|
|
|
install( basedir, localRepository, reader, "jar" );
|
2004-08-09 14:57:50 -04:00
|
|
|
}
|
2005-03-23 01:52:55 -05:00
|
|
|
|
|
|
|
return reader;
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
private void generatePluginDescriptor( String sourceDirectory, String outputDirectory, String pom, ClassLoader cl,
|
|
|
|
Repository localRepository )
|
2005-02-20 11:25:22 -05:00
|
|
|
throws Exception
|
|
|
|
{
|
2005-02-24 00:12:30 -05:00
|
|
|
Class cls = cl.loadClass( "org.apache.maven.tools.plugin.pluggy.Main" );
|
|
|
|
|
2005-03-09 20:35:25 -05:00
|
|
|
Method m = cls.getMethod( "main", new Class[]{String[].class} );
|
2005-02-24 00:12:30 -05:00
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
// Can pluggy really cope with the layout?
|
|
|
|
String[] args = {"descriptor", sourceDirectory, outputDirectory, pom, localRepository.getBasedir()};
|
2005-02-24 00:12:30 -05:00
|
|
|
|
2005-03-09 20:35:25 -05:00
|
|
|
m.invoke( null, new Object[]{args} );
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
|
2005-03-09 20:35:25 -05:00
|
|
|
private void generateSources( String model, String mode, String dir, String modelVersion,
|
2005-04-03 21:36:58 -04:00
|
|
|
String packageWithVersion, ClassLoader modelloClassLoader )
|
2004-07-25 23:53:12 -04:00
|
|
|
throws Exception
|
|
|
|
{
|
2004-09-26 09:29:06 -04:00
|
|
|
Class c = modelloClassLoader.loadClass( "org.codehaus.modello.ModelloCli" );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
|
|
|
Object generator = c.newInstance();
|
|
|
|
|
2005-03-09 20:35:25 -05:00
|
|
|
Method m = c.getMethod( "main", new Class[]{String[].class} );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-03-09 20:35:25 -05:00
|
|
|
String[] args = new String[]{model, mode, dir, modelVersion, packageWithVersion};
|
2004-07-25 23:53:12 -04:00
|
|
|
|
|
|
|
ClassLoader old = Thread.currentThread().getContextClassLoader();
|
|
|
|
|
2004-09-26 09:29:06 -04:00
|
|
|
Thread.currentThread().setContextClassLoader( modelloClassLoader );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-03-09 20:35:25 -05:00
|
|
|
m.invoke( generator, new Object[]{args} );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
|
|
|
Thread.currentThread().setContextClassLoader( old );
|
|
|
|
}
|
|
|
|
|
2005-04-04 10:35:06 -04:00
|
|
|
private IsolatedClassLoader createClassloaderFromDependencies( Collection dependencies, ClassLoader parent,
|
2005-04-04 01:08:45 -04:00
|
|
|
Repository localRepository )
|
2005-03-09 20:35:25 -05:00
|
|
|
throws Exception
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
2005-04-03 21:36:58 -04:00
|
|
|
if ( online )
|
|
|
|
{
|
|
|
|
System.out.println( "Checking for dependencies ..." );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-03 21:36:58 -04:00
|
|
|
downloader.downloadDependencies( dependencies );
|
|
|
|
}
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-03 22:31:56 -04:00
|
|
|
IsolatedClassLoader cl;
|
|
|
|
if ( parent == null )
|
|
|
|
{
|
|
|
|
cl = new IsolatedClassLoader();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
cl = new IsolatedClassLoader( parent );
|
|
|
|
}
|
2005-04-03 21:36:58 -04:00
|
|
|
|
|
|
|
for ( Iterator i = dependencies.iterator(); i.hasNext(); )
|
|
|
|
{
|
|
|
|
Dependency dependency = (Dependency) i.next();
|
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
File f = localRepository.getArtifactFile( dependency );
|
2005-04-03 21:36:58 -04:00
|
|
|
if ( !f.exists() )
|
|
|
|
{
|
|
|
|
String msg = ( !online ? "; run again online" : "; there was a problem downloading it earlier" );
|
|
|
|
throw new FileNotFoundException( "Missing dependency: " + dependency + msg );
|
|
|
|
}
|
2005-03-09 00:48:31 -05:00
|
|
|
|
2005-04-03 22:01:49 -04:00
|
|
|
cl.addURL( f.toURL() );
|
2005-04-03 21:36:58 -04:00
|
|
|
}
|
|
|
|
|
2005-04-03 22:01:49 -04:00
|
|
|
return cl;
|
2005-03-09 00:48:31 -05:00
|
|
|
}
|
|
|
|
|
2005-03-23 01:52:55 -05:00
|
|
|
private void createJar( String classes, String buildDir, ModelReader reader )
|
2005-03-09 20:35:25 -05:00
|
|
|
throws Exception
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
|
|
|
JarMojo jarMojo = new JarMojo();
|
|
|
|
|
2005-04-03 21:36:58 -04:00
|
|
|
String artifactId = reader.getArtifactId();
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-03 21:36:58 -04:00
|
|
|
String version = reader.getVersion();
|
2004-07-25 23:53:12 -04:00
|
|
|
|
|
|
|
jarMojo.execute( new File( classes ), buildDir, artifactId + "-" + version );
|
|
|
|
}
|
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
private void installPomFile( Repository localRepository, File pomIn )
|
2005-03-09 20:35:25 -05:00
|
|
|
throws Exception
|
2004-07-26 21:19:41 -04:00
|
|
|
{
|
2005-04-04 10:35:06 -04:00
|
|
|
ModelReader reader = new ModelReader( downloader, false );
|
2005-03-23 01:52:55 -05:00
|
|
|
|
2005-04-04 01:23:01 -04:00
|
|
|
reader.parse( pomIn );
|
2004-07-26 21:19:41 -04:00
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
installPomFile( reader, localRepository, pomIn );
|
|
|
|
}
|
2004-07-26 21:19:41 -04:00
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
private void installPom( String basedir, Repository localRepository, ModelReader reader )
|
|
|
|
throws Exception
|
|
|
|
{
|
|
|
|
installPomFile( reader, localRepository, new File( basedir, "pom.xml" ) );
|
2004-07-26 21:19:41 -04:00
|
|
|
|
|
|
|
}
|
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
private void installPomFile( ModelReader reader, Repository localRepository, File source )
|
|
|
|
throws IOException
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
2005-04-03 21:36:58 -04:00
|
|
|
String artifactId = reader.getArtifactId();
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-03 21:36:58 -04:00
|
|
|
String version = reader.getVersion();
|
2005-03-23 01:52:55 -05:00
|
|
|
|
2005-04-03 21:36:58 -04:00
|
|
|
String groupId = reader.getGroupId();
|
2005-03-23 01:52:55 -05:00
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
File pom = localRepository.getArtifactFile( groupId, artifactId, version, "pom" );
|
2004-07-26 18:45:09 -04:00
|
|
|
|
|
|
|
System.out.println( "Installing POM: " + pom );
|
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
FileUtils.copyFile( source, pom );
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
private void install( String basedir, Repository localRepository, ModelReader reader, String type )
|
2005-03-09 20:35:25 -05:00
|
|
|
throws Exception
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
2005-04-03 21:36:58 -04:00
|
|
|
String artifactId = reader.getArtifactId();
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-03 21:36:58 -04:00
|
|
|
String version = reader.getVersion();
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-03 21:36:58 -04:00
|
|
|
String groupId = reader.getGroupId();
|
2005-03-23 01:52:55 -05:00
|
|
|
|
2005-03-31 05:54:32 -05:00
|
|
|
String finalName = artifactId + "-" + version;
|
2004-07-26 21:19:41 -04:00
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
File file = localRepository.getArtifactFile( groupId, artifactId, version, type );
|
2004-07-26 21:19:41 -04:00
|
|
|
|
2005-03-31 05:54:32 -05:00
|
|
|
System.out.println( "Installing: " + file );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-03-31 05:54:32 -05:00
|
|
|
if ( version.indexOf( "SNAPSHOT" ) >= 0 )
|
2005-03-23 01:52:55 -05:00
|
|
|
{
|
2005-04-04 01:08:45 -04:00
|
|
|
File metadata = localRepository.getMetadataFile( groupId, artifactId, version, type,
|
|
|
|
finalName + ".version.txt" );
|
2005-03-23 01:52:55 -05:00
|
|
|
|
2005-03-31 05:54:32 -05:00
|
|
|
IOUtil.copy( new StringReader( version ), new FileWriter( metadata ) );
|
2005-03-23 01:52:55 -05:00
|
|
|
}
|
2005-04-04 01:08:45 -04:00
|
|
|
|
|
|
|
FileUtils.copyFile( new File( basedir, BUILD_DIR + "/" + finalName + ".jar" ), file );
|
|
|
|
|
2004-08-09 14:57:50 -04:00
|
|
|
}
|
|
|
|
|
2005-04-03 22:57:27 -04:00
|
|
|
private void runTests( String basedir, String classes, String testClasses, ModelReader reader,
|
2005-04-04 01:08:45 -04:00
|
|
|
List surefireDependencies, Repository localRepository )
|
2005-03-09 20:35:25 -05:00
|
|
|
throws Exception
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
|
|
|
SurefirePlugin testRunner = new SurefirePlugin();
|
|
|
|
|
|
|
|
List includes;
|
|
|
|
|
|
|
|
List excludes;
|
|
|
|
|
2005-03-09 20:35:25 -05:00
|
|
|
includes = new ArrayList();
|
2004-07-27 07:24:04 -04:00
|
|
|
|
2005-03-09 20:35:25 -05:00
|
|
|
includes.add( "**/*Test.java" );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-03-09 20:35:25 -05:00
|
|
|
excludes = new ArrayList();
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-03-09 20:35:25 -05:00
|
|
|
excludes.add( "**/*Abstract*.java" );
|
2005-03-17 18:59:07 -05:00
|
|
|
|
2005-03-23 01:52:55 -05:00
|
|
|
String reportsDir = new File( basedir, "target/surefire-reports" ).getAbsolutePath();
|
2005-03-17 18:59:07 -05:00
|
|
|
|
2005-04-03 22:57:27 -04:00
|
|
|
List depList = new ArrayList( reader.getDependencies() );
|
|
|
|
depList.addAll( surefireDependencies );
|
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
List classpath = classpath( depList, null, SCOPE_TEST, localRepository );
|
2005-04-03 22:57:27 -04:00
|
|
|
classpath.add( classes );
|
|
|
|
classpath.add( testClasses );
|
2005-04-05 00:11:03 -04:00
|
|
|
|
2005-04-03 22:57:27 -04:00
|
|
|
boolean success = testRunner.execute( basedir, includes, excludes, classpath, reportsDir );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2004-08-11 02:21:13 -04:00
|
|
|
if ( !success )
|
|
|
|
{
|
2004-10-25 10:22:51 -04:00
|
|
|
throw new Exception( "Tests error" );
|
2004-08-11 02:21:13 -04:00
|
|
|
}
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
// Compile
|
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
2005-04-04 10:35:06 -04:00
|
|
|
private List classpath( Collection dependencies, String extraClasspath, String scope, Repository localRepository )
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
2005-04-03 22:01:49 -04:00
|
|
|
List classpath = new ArrayList( dependencies.size() + 1 );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-04 10:35:06 -04:00
|
|
|
for ( Iterator i = dependencies.iterator(); i.hasNext(); )
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
2005-04-04 10:35:06 -04:00
|
|
|
Dependency d = (Dependency) i.next();
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-04-04 01:08:45 -04:00
|
|
|
String element = localRepository.getArtifactFile( d ).getAbsolutePath();
|
2005-04-03 22:01:49 -04:00
|
|
|
|
|
|
|
if ( SCOPE_COMPILE.equals( scope ) )
|
|
|
|
{
|
|
|
|
if ( d.getScope().equals( SCOPE_COMPILE ) )
|
|
|
|
{
|
|
|
|
classpath.add( element );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( SCOPE_RUNTIME.equals( scope ) )
|
|
|
|
{
|
|
|
|
if ( d.getScope().equals( SCOPE_COMPILE ) || d.getScope().equals( SCOPE_RUNTIME ) )
|
|
|
|
{
|
|
|
|
classpath.add( element );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( SCOPE_TEST.equals( scope ) )
|
|
|
|
{
|
|
|
|
classpath.add( element );
|
|
|
|
}
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
|
2005-04-05 00:11:03 -04:00
|
|
|
if ( extraClasspath != null )
|
|
|
|
{
|
|
|
|
classpath.add( extraClasspath );
|
|
|
|
}
|
2004-07-25 23:53:12 -04:00
|
|
|
|
|
|
|
return classpath;
|
|
|
|
}
|
|
|
|
|
2005-04-04 10:35:06 -04:00
|
|
|
private void compile( Collection dependencies, String sourceDirectory, String outputDirectory,
|
|
|
|
String extraClasspath, String generatedSources, String scope, Repository localRepository )
|
2005-03-09 20:35:25 -05:00
|
|
|
throws Exception
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
|
|
|
JavacCompiler compiler = new JavacCompiler();
|
|
|
|
|
|
|
|
String[] sourceDirectories = null;
|
|
|
|
|
|
|
|
if ( generatedSources != null )
|
|
|
|
{
|
|
|
|
// We might only have generated sources
|
|
|
|
|
|
|
|
if ( new File( sourceDirectory ).exists() )
|
|
|
|
{
|
2005-03-09 20:35:25 -05:00
|
|
|
sourceDirectories = new String[]{sourceDirectory, generatedSources};
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-03-09 20:35:25 -05:00
|
|
|
sourceDirectories = new String[]{generatedSources};
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
if ( new File( sourceDirectory ).exists() )
|
|
|
|
{
|
2005-03-09 20:35:25 -05:00
|
|
|
sourceDirectories = new String[]{sourceDirectory};
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if ( sourceDirectories != null )
|
|
|
|
{
|
2005-01-09 17:38:43 -05:00
|
|
|
CompilerConfiguration compilerConfiguration = new CompilerConfiguration();
|
2005-02-24 00:12:30 -05:00
|
|
|
compilerConfiguration.setOutputLocation( outputDirectory );
|
2005-04-05 00:11:03 -04:00
|
|
|
List classpathEntries = classpath( dependencies, extraClasspath, scope, localRepository );
|
|
|
|
compilerConfiguration.setClasspathEntries( classpathEntries );
|
2005-02-24 00:12:30 -05:00
|
|
|
compilerConfiguration.setSourceLocations( Arrays.asList( sourceDirectories ) );
|
|
|
|
|
2005-01-09 17:38:43 -05:00
|
|
|
/* Compile with debugging info */
|
|
|
|
String debugAsString = System.getProperty( "maven.compiler.debug" );
|
2004-07-25 23:53:12 -04:00
|
|
|
|
2005-01-09 17:38:43 -05:00
|
|
|
if ( debugAsString != null )
|
|
|
|
{
|
|
|
|
if ( Boolean.valueOf( debugAsString ).booleanValue() )
|
|
|
|
{
|
|
|
|
compilerConfiguration.setDebug( true );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-02-24 00:12:30 -05:00
|
|
|
List messages = compiler.compile( compilerConfiguration );
|
2005-01-09 17:38:43 -05:00
|
|
|
|
|
|
|
for ( Iterator i = messages.iterator(); i.hasNext(); )
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
|
|
|
System.out.println( i.next() );
|
|
|
|
}
|
2004-08-11 02:21:13 -04:00
|
|
|
|
2005-01-09 17:38:43 -05:00
|
|
|
if ( messages.size() > 0 )
|
2004-08-11 02:21:13 -04:00
|
|
|
{
|
|
|
|
throw new Exception( "Compilation error." );
|
|
|
|
}
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// ----------------------------------------------------------------------
|
2005-04-03 21:36:58 -04:00
|
|
|
// model.Resource copying
|
2004-07-25 23:53:12 -04:00
|
|
|
// ----------------------------------------------------------------------
|
|
|
|
|
2005-03-09 20:35:25 -05:00
|
|
|
private void copyResources( String sourceDirectory, String destinationDirectory )
|
|
|
|
throws Exception
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
|
|
|
File sd = new File( sourceDirectory );
|
|
|
|
|
|
|
|
if ( !sd.exists() )
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
List files = FileUtils.getFiles( sd, "**/**", "**/CVS/**", false );
|
|
|
|
|
|
|
|
for ( Iterator i = files.iterator(); i.hasNext(); )
|
|
|
|
{
|
|
|
|
File f = (File) i.next();
|
|
|
|
|
|
|
|
File source = new File( sourceDirectory, f.getPath() );
|
|
|
|
|
|
|
|
File dest = new File( destinationDirectory, f.getPath() );
|
|
|
|
|
|
|
|
if ( !dest.getParentFile().exists() )
|
|
|
|
{
|
|
|
|
dest.getParentFile().mkdirs();
|
|
|
|
}
|
|
|
|
|
|
|
|
FileUtils.copyFile( source, dest );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-16 01:29:35 -05:00
|
|
|
class SettingsReader
|
2005-03-09 17:13:07 -05:00
|
|
|
extends AbstractReader
|
|
|
|
{
|
2005-03-16 01:29:35 -05:00
|
|
|
private List profiles = new ArrayList();
|
2005-03-09 17:13:07 -05:00
|
|
|
|
2005-03-16 01:29:35 -05:00
|
|
|
private Profile currentProfile = null;
|
2005-03-09 17:13:07 -05:00
|
|
|
|
2005-03-17 01:11:17 -05:00
|
|
|
private List proxies = new ArrayList();
|
|
|
|
|
|
|
|
private Proxy currentProxy = null;
|
|
|
|
|
2005-03-09 17:13:07 -05:00
|
|
|
private StringBuffer currentBody = new StringBuffer();
|
|
|
|
|
2005-03-17 01:11:17 -05:00
|
|
|
private Profile activeProfile = null;
|
2005-03-09 17:13:07 -05:00
|
|
|
|
2005-03-17 01:11:17 -05:00
|
|
|
private Proxy activeProxy = null;
|
|
|
|
|
|
|
|
public Profile getActiveProfile()
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
2005-03-17 01:11:17 -05:00
|
|
|
return activeProfile;
|
|
|
|
}
|
|
|
|
|
|
|
|
public Proxy getActiveProxy()
|
|
|
|
{
|
|
|
|
return activeProxy;
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
|
2005-03-09 20:35:25 -05:00
|
|
|
public void characters( char[] ch, int start, int length )
|
|
|
|
throws SAXException
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
2005-03-09 17:13:07 -05:00
|
|
|
currentBody.append( ch, start, length );
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
|
2005-03-09 20:35:25 -05:00
|
|
|
public void endElement( String uri, String localName, String rawName )
|
|
|
|
throws SAXException
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
2005-03-16 01:29:35 -05:00
|
|
|
if ( "profile".equals( rawName ) )
|
2005-03-09 17:13:07 -05:00
|
|
|
{
|
2005-03-16 01:29:35 -05:00
|
|
|
if ( notEmpty( currentProfile.getLocalRepo() ) )
|
2005-03-09 17:13:07 -05:00
|
|
|
{
|
2005-03-16 01:29:35 -05:00
|
|
|
profiles.add( currentProfile );
|
2005-03-09 17:13:07 -05:00
|
|
|
currentProfile = null;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-03-16 01:29:35 -05:00
|
|
|
throw new SAXException( "Invalid profile entry. Missing one or more " +
|
|
|
|
"fields: {localRepository}." );
|
2005-03-09 17:13:07 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( currentProfile != null )
|
|
|
|
{
|
2005-03-16 01:29:35 -05:00
|
|
|
if ( "active".equals( rawName ) )
|
2005-03-09 17:13:07 -05:00
|
|
|
{
|
2005-03-17 18:59:07 -05:00
|
|
|
currentProfile.setActive( Boolean.valueOf( currentBody.toString().trim() ).booleanValue() );
|
2005-03-09 17:13:07 -05:00
|
|
|
}
|
|
|
|
else if ( "localRepository".equals( rawName ) )
|
|
|
|
{
|
|
|
|
currentProfile.setLocalRepo( currentBody.toString().trim() );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-03-16 01:29:35 -05:00
|
|
|
throw new SAXException( "Illegal element inside profile: \'" + rawName + "\'" );
|
2005-03-09 17:13:07 -05:00
|
|
|
}
|
|
|
|
}
|
2005-03-17 01:11:17 -05:00
|
|
|
else if ( "proxy".equals( rawName ) )
|
|
|
|
{
|
|
|
|
if ( notEmpty( currentProxy.getHost() ) && notEmpty( currentProxy.getPort() ) )
|
|
|
|
{
|
|
|
|
proxies.add( currentProxy );
|
|
|
|
currentProxy = null;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2005-03-17 18:59:07 -05:00
|
|
|
throw new SAXException( "Invalid proxy entry. Missing one or more " + "fields: {host, port}." );
|
2005-03-17 01:11:17 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else if ( currentProxy != null )
|
|
|
|
{
|
|
|
|
if ( "active".equals( rawName ) )
|
|
|
|
{
|
2005-03-17 18:59:07 -05:00
|
|
|
currentProxy.setActive( Boolean.valueOf( currentBody.toString().trim() ).booleanValue() );
|
2005-03-17 01:11:17 -05:00
|
|
|
}
|
|
|
|
else if ( "host".equals( rawName ) )
|
|
|
|
{
|
|
|
|
currentProxy.setHost( currentBody.toString().trim() );
|
|
|
|
}
|
|
|
|
else if ( "port".equals( rawName ) )
|
|
|
|
{
|
|
|
|
currentProxy.setPort( currentBody.toString().trim() );
|
|
|
|
}
|
|
|
|
else if ( "username".equals( rawName ) )
|
|
|
|
{
|
|
|
|
currentProxy.setUserName( currentBody.toString().trim() );
|
|
|
|
}
|
|
|
|
else if ( "password".equals( rawName ) )
|
|
|
|
{
|
|
|
|
currentProxy.setPassword( currentBody.toString().trim() );
|
|
|
|
}
|
|
|
|
else if ( "protocol".equals( rawName ) )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else if ( "nonProxyHosts".equals( rawName ) )
|
|
|
|
{
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
throw new SAXException( "Illegal element inside proxy: \'" + rawName + "\'" );
|
|
|
|
}
|
|
|
|
}
|
2005-03-16 01:29:35 -05:00
|
|
|
else if ( "settings".equals( rawName ) )
|
2005-03-09 17:13:07 -05:00
|
|
|
{
|
2005-03-17 18:59:07 -05:00
|
|
|
if ( profiles.size() == 1 )
|
2005-03-16 01:29:35 -05:00
|
|
|
{
|
2005-03-17 18:59:07 -05:00
|
|
|
activeProfile = (Profile) profiles.get( 0 );
|
2005-03-16 01:29:35 -05:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
for ( Iterator it = profiles.iterator(); it.hasNext(); )
|
|
|
|
{
|
|
|
|
Profile profile = (Profile) it.next();
|
2005-03-17 18:59:07 -05:00
|
|
|
if ( profile.isActive() )
|
2005-03-17 01:11:17 -05:00
|
|
|
{
|
|
|
|
activeProfile = profile;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if ( proxies.size() != 0 )
|
|
|
|
{
|
|
|
|
for ( Iterator it = proxies.iterator(); it.hasNext(); )
|
|
|
|
{
|
|
|
|
Proxy proxy = (Proxy) it.next();
|
2005-03-17 18:59:07 -05:00
|
|
|
if ( proxy.isActive() )
|
2005-03-16 01:29:35 -05:00
|
|
|
{
|
2005-03-17 01:11:17 -05:00
|
|
|
activeProxy = proxy;
|
2005-03-16 01:29:35 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2005-03-09 17:13:07 -05:00
|
|
|
}
|
2005-03-09 20:35:25 -05:00
|
|
|
|
2005-03-09 17:13:07 -05:00
|
|
|
currentBody = new StringBuffer();
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
|
2005-03-09 17:13:07 -05:00
|
|
|
private boolean notEmpty( String test )
|
2004-07-25 23:53:12 -04:00
|
|
|
{
|
2005-03-09 17:13:07 -05:00
|
|
|
return test != null && test.trim().length() > 0;
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
2005-03-09 17:13:07 -05:00
|
|
|
|
|
|
|
public void startElement( String uri, String localName, String rawName, Attributes attributes )
|
|
|
|
throws SAXException
|
|
|
|
{
|
2005-03-16 01:29:35 -05:00
|
|
|
if ( "profile".equals( rawName ) )
|
2005-03-09 17:13:07 -05:00
|
|
|
{
|
2005-03-16 01:29:35 -05:00
|
|
|
currentProfile = new Profile();
|
2005-03-09 17:13:07 -05:00
|
|
|
}
|
2005-03-17 01:11:17 -05:00
|
|
|
else if ( "proxy".equals( rawName ) )
|
|
|
|
{
|
|
|
|
currentProxy = new Proxy();
|
|
|
|
}
|
2005-03-09 17:13:07 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public void reset()
|
|
|
|
{
|
|
|
|
this.currentBody = null;
|
2005-03-17 01:11:17 -05:00
|
|
|
this.activeProfile = null;
|
|
|
|
this.activeProxy = null;
|
2005-03-09 17:13:07 -05:00
|
|
|
this.currentProfile = null;
|
2005-03-16 01:29:35 -05:00
|
|
|
this.profiles.clear();
|
2005-03-17 01:11:17 -05:00
|
|
|
this.proxies.clear();
|
2005-03-09 17:13:07 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-03-16 01:29:35 -05:00
|
|
|
public static class Profile
|
2005-03-09 17:13:07 -05:00
|
|
|
{
|
|
|
|
private String localRepo;
|
|
|
|
|
2005-03-16 01:29:35 -05:00
|
|
|
private boolean active = false;
|
2005-03-09 17:13:07 -05:00
|
|
|
|
|
|
|
public void setLocalRepo( String localRepo )
|
|
|
|
{
|
|
|
|
this.localRepo = localRepo;
|
|
|
|
}
|
|
|
|
|
2005-03-16 01:29:35 -05:00
|
|
|
public boolean isActive()
|
2005-03-09 17:13:07 -05:00
|
|
|
{
|
2005-03-16 01:29:35 -05:00
|
|
|
return active;
|
2005-03-09 17:13:07 -05:00
|
|
|
}
|
|
|
|
|
2005-03-16 01:29:35 -05:00
|
|
|
public void setActive( boolean active )
|
2005-03-09 17:13:07 -05:00
|
|
|
{
|
2005-03-16 01:29:35 -05:00
|
|
|
this.active = active;
|
2005-03-09 17:13:07 -05:00
|
|
|
}
|
|
|
|
|
2005-03-16 01:29:35 -05:00
|
|
|
public String getLocalRepo()
|
2005-03-09 17:13:07 -05:00
|
|
|
{
|
2005-03-16 01:29:35 -05:00
|
|
|
return localRepo;
|
2005-03-09 17:13:07 -05:00
|
|
|
}
|
2005-03-17 01:11:17 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
public class Proxy
|
|
|
|
{
|
|
|
|
private boolean active;
|
|
|
|
|
|
|
|
private String host;
|
|
|
|
|
|
|
|
private String port;
|
|
|
|
|
|
|
|
private String userName;
|
|
|
|
|
|
|
|
private String password;
|
|
|
|
|
|
|
|
public boolean isActive()
|
|
|
|
{
|
|
|
|
return active;
|
|
|
|
}
|
2005-03-09 17:13:07 -05:00
|
|
|
|
2005-03-17 01:11:17 -05:00
|
|
|
public void setActive( boolean active )
|
|
|
|
{
|
|
|
|
this.active = active;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setHost( String host )
|
|
|
|
{
|
|
|
|
this.host = host;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getHost()
|
|
|
|
{
|
|
|
|
return host;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setPort( String port )
|
|
|
|
{
|
|
|
|
this.port = port;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getPort()
|
|
|
|
{
|
|
|
|
return port;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setUserName( String userName )
|
|
|
|
{
|
|
|
|
this.userName = userName;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getUserName()
|
|
|
|
{
|
|
|
|
return userName;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setPassword( String password )
|
|
|
|
{
|
|
|
|
this.password = password;
|
|
|
|
}
|
|
|
|
|
|
|
|
public String getPassword()
|
|
|
|
{
|
|
|
|
return password;
|
|
|
|
}
|
2004-07-25 23:53:12 -04:00
|
|
|
}
|
|
|
|
|
2005-03-16 01:55:36 -05:00
|
|
|
}
|