I like it too since it makes it easier to use Maven outside of Jakarta. I'm not sure if I have any +'s over here, but I'd give it one.
We are now using Maven (with the new feature) to build 4 of our 5 internal projects. Cheers, Aaron > -----Original Message----- > From: Hanson Char > Sent: Friday, June 07, 2002 1:59 PM > To: 'Turbine Maven Developers List' > Cc: NYC06-RCJAVA; NYC06-IHUB > Subject: RE: Optional Feature: Zero dependency configuration > > Hi Vincent, > > > Should this feature be accepted, I would prefer an include rather than > > an exclude (because you don't control list of jars with an > > exclude). Or > > maybe both. > > But BOTH include list and exclude list are already supported! The include > list is supported since "lib.repo.dynamic" allows one to specify NOT only > multiple directories but also multiple jar/zip files directly. They all > get added to the classpath in the exact order of specification, unless > being excluded in the exclude list. > > > ... so that every project publishes its jar to a common repository. > > Contrary to this, we prefer to have some flexibility. We prefer to have > multiple repositories so we can group jars into under different "logical" > categories. In the long run, wouldn't multiple repositories be more > scalable ? > > Hanson > > > -----Original Message----- > > From: Vincent Massol [mailto:[EMAIL PROTECTED]] > > Sent: Friday, June 07, 2002 12:56 PM > > To: 'Turbine Maven Developers List' > > Subject: RE: Optional Feature: Zero dependency configuration > > > > > > Should this feature be accepted, I would prefer an include rather than > > an exclude (because you don't control list of jars with an > > exclude). Or > > maybe both. > > > > I was also in favor of this but in the end, I am modifying > > our builds so > > that every project publishes its jar to a common repository. > > > > In any case, I am +1 for this feature as an easy way for projects to > > migrate to Maven. > > > > Also, I see the need to have different repositories. At least one for > > jars needed at build time and another one for jars needed at runtime. > > > > Thanks > > -Vincent > > > > > -----Original Message----- > > > From: Hanson Char [mailto:[EMAIL PROTECTED]] > > > Sent: 07 June 2002 17:16 > > > To: '[EMAIL PROTECTED]' > > > Cc: NYC06-RCJAVA; NYC06-IHUB > > > Subject: RE: Optional Feature: Zero dependency configuration > > > > > > Below is a sample specification in either project.properties or > > > build.properties: > > > > > > lib.repo.dynamic = c:/cvs/portal/lib, c:/cvs/portal/lib/build > > > > > > lib.repo.dynamic.exclude = c:/cvs/portal/lib/boot.jar, > > > c:/cvs/portal/lib/boot_app.jar, \ > > > c:/cvs/portal/lib/boot_remote.jar, > > > c:/cvs/portal/lib/build/rcoll.jar, \ > > > c:/cvs/portal/lib/build/ejb_sl_tiff2gif.jar, > > > c:/cvs/portal/lib/build/transportv2.jar > > > > > > Hanson > > > > -----Original Message----- > > > > From: Hanson Char > > > > Sent: Friday, June 07, 2002 11:57 AM > > > > To: '[EMAIL PROTECTED]' > > > > Cc: NYC06-RCJAVA; NYC06-IHUB > > > > Subject: Optional Feature: Zero dependency configuration > > > > > > > > > > > > I notice the need in Maven to specify the jar/zip file > > > > dependency both in the project.xml and in "lib.repo" or > > > > "maven.repo.remote". > > > > > > > > However, our existing projects have pretty large sizes using > > > > a lot of jar/zip files residing in multiple directories. So > > > > I suggest to support of the optional feature of "zero > > > > dependency configuration". > > > > > > > > Specifically, > > > > > > > > 1) specify the "lib.repo.dynamic" property to point to a list > > > > of directories or direct jar/zip files. Jar/zip files both > > > > from those directories and directly specified will be > > > > automatically added to the runtime classpath by Maven. > > > > > > > > 2) specify the "lib.repo.dynamic.exclude" property to point > > > > to a list of jar/zip files to be explicitly excluded from > > > > being loaded during the dynamic loading process. > > > > > > > > 3) (2) always overrides (1). > > > > > > > > 4) These properties are an optional features, and they can > > > > work with the existing properties of Maven at the same time > > > > without conflicts. > > > > > > > > By using these properties, the <dependencies> elements can be > > > > entirely commented out or omitted from project.xml. > > > > > > > > To support the new properties, I created on class > > > > DynamicRepo.java and added one line of code to > > > > ProjectProperties.java (MAVEN_1_0_B4 (revision: 1.43)). > > > > > > > > Please find below the source codes for the suggested changes. > > > > They work nicely in our installation. > > > > > > > > Just wonder if your group like the idea, and if so if you can > > > > incorporate the changes to your CVS repository, so we can > > > > still have the feature for future releases. > > > > > > > > Thanks, > > > > Hanson > > > > > > > > org.apache.maven.ProjectProperties.java > > > > --------------------------------------- > > > > private void createClasspathReference() > > > > { > > > > Path classpath = new Path(getProject()); > > > > > > > > for (Iterator i = > > > > getMavenProject().getDependencies().iterator(); > > > > i.hasNext();) > > > > { > > > > Dependency dependency = (Dependency) i.next(); > > > > > > > > Path p = new Path(getProject()); > > > > p.setPath(new File(libRepo, > > > > dependency.getJar()).getAbsolutePath()); > > > > classpath.append(p); > > > > } > > > > ///////////// Change: start > > > > DynamicRepo.addDynClasspathReference(getProject(), > > classpath); > > > > ///////////// Change: end > > > > > > > > getProject().addReference("maven.dependency.classpath", > > classpath); > > > > } > > > > > > > > org.apache.maven.DynamicRepo.java (new class) > > > > --------------------------------- > > > > package org.apache.maven; > > > > > > > > import java.io.*; > > > > import java.util.*; > > > > > > > > import org.apache.tools.ant.*; > > > > import org.apache.tools.ant.types.*; > > > > /** > > > > * Dynamic repository which supports the optional feature of > > > > zero-dependency configuration. > > > > * It automatic loads a set of jar/zip files to the classpath > > > > from a list of comma-delimited > > > > * directories or files specified in the project property > > > > "lib.repo.dynamic". > > > > * > > > > * An optional set of files can be explicitely excluded from > > > > being loaded via the dynamic repository. > > > > * These files are specified as a list of comma-delimited > > > > jar/zip files in the > > > > * project property "lib.repo.dynamic.exclude". > > > > * > > > > * @author Hanson Char > > > > * @version 1.0 > > > > */ > > > > class DynamicRepo { > > > > private static final String DELIMITER = ","; > > > > /** > > > > * Dynamically adds the jar/zip files to the classpath. > > > > * @project the current project. > > > > * @classpath the current classpath. > > > > */ > > > > static void addDynClasspathReference(Project project, final > > > > Path classpath) > > > > { > > > > String dynlibRepo = project.getProperty("lib.repo.dynamic"); > > > > > > > > if (dynlibRepo == null || dynlibRepo.trim().length() == 0) { > > > > // dynamic repository not specified. > > > > return; > > > > } > > > > final Set excludeFileSet = > > > > > > loadExcludeFileSet(project.getProperty("lib.repo.dynamic.exclude")); > > > > // Figure out the set of file/dir to be used for > > dynamic lookup. > > > > StringTokenizer st = new StringTokenizer(dynlibRepo, > > > > DELIMITER, true); > > > > > > > > while (st.hasMoreTokens()) { > > > > String token = st.nextToken(); > > > > > > > > if (token.equals(DELIMITER)) { > > > > continue; > > > > } > > > > File file = new File(token.trim()); > > > > > > > > if (!file.exists()) { > > > > continue; > > > > } > > > > if (file.isFile()) { > > > > String name = file.getName(); > > > > > > > > if (name.endsWith(".jar") || name.endsWith(".zip")) { > > > > if (!excludeFileSet.contains(file)) { > > > > addFilesToClasspath(project, classpath, new > > File[]{file}); > > > > } > > > > } > > > > continue; > > > > } > > > > // directory. > > > > File[] list = file.listFiles(new FilenameFilter() { > > > > public boolean accept(File dir, String name) { > > > > return (name.endsWith(".jar") || name.endsWith(".zip")) > > > > && !excludeFileSet.contains(new File(dir, name)); > > > > } > > > > }); > > > > addFilesToClasspath(project, classpath, list); > > > > } > > > > } > > > > /** Returns a set of jar/zip files to be excluded from > > > > dynamic loading. */ > > > > private static Set loadExcludeFileSet(String > > dynlibRepoExclude) { > > > > Set set = new HashSet(); > > > > > > > > if (dynlibRepoExclude == null || > > > > dynlibRepoExclude.trim().length() == 0) { > > > > // exclude list not specified. > > > > return set; > > > > } > > > > StringTokenizer st = new > > > > StringTokenizer(dynlibRepoExclude, DELIMITER, true); > > > > > > > > while (st.hasMoreTokens()) { > > > > String token = st.nextToken(); > > > > > > > > if (token.equals(DELIMITER)) { > > > > continue; > > > > } > > > > File file = new File(token.trim()); > > > > > > > > if (!file.exists() || !file.isFile()) { > > > > continue; > > > > } > > > > String name = file.getName(); > > > > > > > > if (!name.endsWith(".jar") && !name.endsWith(".zip")) { > > > > continue; > > > > } > > > > set.add(file); > > > > } > > > > return set; > > > > } > > > > /** Adds the given set of files to the specified classpath. */ > > > > private static void addFilesToClasspath(Project project, > > > > Path classpath, File[] file) > > > > { > > > > for (int i=0; i < file.length; i++) { > > > > Path p = new Path(project); > > > > System.out.println(new StringBuffer() > > > > .append("DynamicRepo>>Adding ") > > > > .append(file[i]) > > > > .append(" to classpath.") > > > > .toString()); > > > > p.setPath(file[i].getAbsolutePath()); > > > > classpath.append(p); > > > > } > > > > } > > > > } > > > > > > > > /////////////////////////////// end > > /////////////////////////////// > > > > > > > > > > -- > > To unsubscribe, e-mail: > > <mailto:[EMAIL PROTECTED]> > > For additional commands, e-mail: > > <mailto:[EMAIL PROTECTED]> > >
