Jason van Zyl wrote:import org.apache.maven.MavenUtils;
File f = new File( "project.xml" ); Project p = MavenUtils.getProject( f );
Well... doesn't sound perfect...
-> runing this as a test gives me an out-of-memory error, it looks like it's not a good idea to invoke MavenUtils.getProject(file) from within maven
Well, not even inside maven.
I attached the project.xml and the java test file I'm running... is it a test case ? Should I switch to cvs head ?
Thanks.
Paul
<?xml version="1.0" encoding="utf-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./maven-project.xsd"> <!-- the version of maven's project object model --> <pomVersion>3</pomVersion> <!-- a unique name for this project --> <id>MavenRepoJNLP</id> <!-- a short but descriptive name for the project --> <name>The JNLP connection to the Maven repository</name> <!-- The version of the project under development, e.g. 1.1, 1.2, 2.0-dev --> <currentVersion>0.1</currentVersion> <!-- details about the organization that 'owns' the project --> <organization> <name>The ActiveMath group, DFKI and Universität des Saarlandes</name> <url>http://www.activemath.org/</url> <logo>http://www.activemath.org/~paul/tmp/MavenProjectPics/AM_Logo.png</logo> </organization><!-- FIXME: no reason to put ActiveMath URL or ? --> <!-- the year the project started --> <inceptionYear>2001</inceptionYear> <package>org.activemath</package> <logo>http://www.activemath.org/~paul/tmp/MavenProjectPics/LogoOMDocJDOM.png</logo> <description> The Maven repository JNLP connection is web-application that serves JNLP descriptors (aka Java Web Start) for each maven projects making it possible to resolve classpath-dependencies by means of project dependencies. </description> <!-- a short description of what the project does --> <shortDescription> The maven repository JNLP connection. </shortDescription> <!-- the project home page --> <url>http://www.activemath.org/projects/OmdocJdom/</url> <issueTrackingUrl>http://bugzilla.mathweb.org:8000/</issueTrackingUrl> <!-- <siteAddress>www.activemath.org</siteAddress> <siteDirectory>/www/maven.apache.org/reference/plugins/examples/</siteDirectory> <distributionDirectory>/www/maven.apache.org/builds/</distributionDirectory> --> <!-- the version control repository and http url for online access the connection element has the form: scm:<system>:<system specific connection string> --> <repository> <connection>scm:cvs:pserver:[EMAIL PROTECTED]:/CVS/AMauthoring/projects/OmdocJdom</connection> <!-- <url>http://cvs.apache.org/viewcvs/maven/src/plugins-build/examples/</url> --> </repository> <!-- any mailing lists for the project --> <mailingLists/> <!-- who the developers are for the project --> <developers> <developer> <name>Paul Libbrecht</name> <id>paul</id> <email>[EMAIL PROTECTED]</email> <organization>The ActiveMath group</organization> <roles><role>Java Developer</role></roles> </developer> </developers> <contributors> </contributors> <!-- jar files the project is dependent on --> <dependencies> <dependency> <id>jdom</id> <version>b8</version> </dependency> <dependency> <id>sax</id> <version>2.0.1</version> </dependency> <dependency> <id>log4j</id> <version>1.2.7</version> </dependency> <dependency> <id>ant</id> <version>1.5</version></dependency> <dependency><id>maven</id><version>20030211.132709</version></dependency> <dependency><id>commons-jelly</id><version>20030310.073407</version></dependency> <!-- leave dom4j as the first entry or the tests fail --> <dependency> <id>dom4j</id> <version>1.4-dev-3</version> <url>http://www.dom4j.org/</url> </dependency> <dependency> <id>ant</id> <version>1.4.1</version> <url>http://jakarta.apache.org/ant/</url> </dependency> <dependency> <id>commons-betwixt</id> <version>SNAPSHOT</version> <url>http://jakarta.apache.org/commons/betwixt/</url> </dependency> <dependency> <id>commons-digester</id> <version>1.2</version> <url>http://jakarta.apache.org/commons/digester.html</url> </dependency> <dependency> <id>commons-jelly</id> <version>SNAPSHOT</version> <url>http://jakarta.apache.org/commons/sandbox/jelly/</url> </dependency> <dependency> <id>commons-graph</id> <version>0.8.1</version> <url>http://jakarta.apache.org/commons/sandbox/jelly/</url> </dependency> <dependency> <id>commons-jexl</id> <version>1.0-dev</version> <url>http://jakarta.apache.org/commons/sandbox/jelly/</url> </dependency> <dependency> <id>commons-logging</id> <version>1.0</version> <url>http://jakarta.apache.org/commons/logging.html</url> </dependency> <dependency> <id>junit</id> <version>3.7</version> <type>test</type> <url>http://junit.org/</url> </dependency> <dependency> <id>werkz</id> <version>SNAPSHOT</version> </dependency> <!-- Runtime dependencies --> <dependency> <id>commons-beanutils</id> <version>SNAPSHOT</version> <url>http://jakarta.apache.org/commons/</url> </dependency> <dependency> <id>commons-cli</id> <version>SNAPSHOT</version> <url>http://jakarta.apache.org/commons/cli/</url> </dependency> <dependency> <id>commons-collections</id> <version>2.0</version> <url>http://jakarta.apache.org/commons/</url> </dependency> <dependency> <id>commons-grant</id> <version>1.0-b1</version> <url>http://jakarta.apache.org/commons/sandbox/grant/</url> </dependency> <dependency> <id>commons-io</id> <version>0.2-dev.20020614.122300</version> <url>http://jakarta.apache.org/commons/</url> </dependency> <dependency> <id>commons-lang</id> <version>1.0-b1</version> <url>http://jakarta.apache.org/commons/</url> </dependency> <dependency> <id>commons-util</id> <version>1.0-rc2-dev</version> <url>http://jakarta.apache.org/commons/</url> </dependency> <dependency> <id>forehead</id> <version>1.0-beta-4</version> <url>http://forehead.sf.net/</url> </dependency> <dependency> <id>logkit</id> <version>1.0.1</version> </dependency> <dependency> <id>log4j</id> <version>1.1.3</version> <url>http://jakarta.apache.org/log4j/</url> </dependency> <dependency> <id>which</id> <version>1.0</version> </dependency> - <dependency> <id>xml-apis</id> <version>2.0.2</version> <url>http://xml.apache.org/xerces2-j/</url> </dependency> <dependency><id>xerces</id><version>2.2.1</version></dependency> </dependencies> <!-- build information for the project --> <build> <!-- <nagEmailAddress>[EMAIL PROTECTED]</nagEmailAddress> --> <sourceDirectory>${basedir}/src/java</sourceDirectory> <unitTestSourceDirectory>${basedir}/src/test</unitTestSourceDirectory> <unitTest> <includes> <include>**/Test*.java</include> </includes> </unitTest> </build> <reports> <report>maven-jdepend-plugin</report> <!-- <report>maven-checkstyle-plugin</report> --> <!-- <report>maven-developer-activity-plugin</report> <report>maven-file-activity-plugin</report> <report>maven-license-plugin</report> --> <report>maven-javadoc-plugin</report> <!-- <report>maven-xref-src-plugin</report> <report>maven-xref-test-plugin</report> --> <!-- <report>maven-test-plugin</report> --> <report>maven-tasklist-plugin</report> <report>maven-linkcheck-plugin</report> <report>maven-jxr-plugin</report> </reports> </project>
package org.activemath.author.webstart.mavenrepojnlp; import org.apache.maven.project.Project; import org.apache.maven.MavenUtils; import java.io.File; public class TestRepo extends junit.framework.TestCase { public TestRepo(String name) { super(name); } public void setUp() { } public void tearDown() { } public void testMakeAProject() throws Exception { File file = new File("project.xml"); System.out.println("Creating a project object from " + file ); Project p = MavenUtils.getProject( file ); System.out.println("Have found the project " + p); System.out.println("Dependency-classpath is " + p.getDependencyClasspath()); } public static void main(String[] args) throws Exception { TestRepo t = new TestRepo("from main"); t.testMakeAProject(); } } // class TestRepo
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]