You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Paul Libbrecht <pa...@activemath.org> on 2003/06/30 10:00:42 UTC

Instiating a Project object ( was Re: Executing Maven through Java Webstart)

Paul Libbrecht wrote:
> I was thinking about writing a servlet that would accept as parameters a 
> project name and version, as well as a main-class and invocation 
> attribute. The result would be a jnlp file referring a jar served from 
> the maven repository (probably following the repository chain defined in 
> the associated maven) with references to jnlp-described 
> project-dependencies and their jar(s).

To make that thing short, allow me a quick question: how can I 
instantiate a maven Project object ? Oh, and should I switch to the dev 
list for that ? (just fearing).

Paul


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Instiating a Project object ( was Re: Executing Maven through Java Webstart)

Posted by Paul Libbrecht <pa...@activemath.org>.
Jason van Zyl wrote:
>>>Jason van Zyl wrote:
>>>Jason van Zyl wrote:
>>>
>>>>import org.apache.maven.MavenUtils;
>>>>
>>>>File f = new File( "project.xml" );
>>>>Project p = MavenUtils.getProject( f );

> It works perfectly fine inside Maven. You also have to define what you
> mean "inside Maven". Clarity is your only hope of getting an answer that
> might help you.


Inside maven meant running as a unit-test the given script-bit.
And "not even inside maven" meant running from the command-line.

In both cases, I get an outofmemoryerror.

Paul


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Instiating a Project object ( was Re: Executing Maven through Java Webstart)

Posted by Jason van Zyl <ja...@zenplex.com>.
On Tue, 2003-07-01 at 09:12, Paul Libbrecht wrote:
> Paul Libbrecht wrote:
> > 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 ?

It works perfectly fine inside Maven. You also have to define what you
mean "inside Maven". Clarity is your only hope of getting an answer that
might help you.

> 
> 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:guest@hal.dfki.uni-sb.de:/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>paul@activemath.org</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>turbine-maven-dev@jakarta.apache.org</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: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
-- 
jvz.

Jason van Zyl
jason@zenplex.com
http://tambora.zenplex.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
  
  -- Jacques Ellul, The Technological Society


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Instiating a Project object ( was Re: Executing Maven through Java Webstart)

Posted by Paul Libbrecht <pa...@activemath.org>.
Paul Libbrecht wrote:
> 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

Re: Instiating a Project object ( was Re: Executing Maven through Java Webstart)

Posted by Jason van Zyl <ja...@zenplex.com>.
On Tue, 2003-07-01 at 08:40, Paul Libbrecht wrote:
> Jason van Zyl wrote:
> >>To make that thing short, allow me a quick question: how can I 
> >>instantiate a maven Project object ? Oh, and should I switch to the dev 
> >>list for that ? (just fearing).
> > 
> > 
> > import org.apache.maven.MavenUtils;
> > 
> > File f = new File( "project.xml" );
> > Project p = MavenUtils.getProject( f );
> > 
> 
> 
> Well... doesn't sound perfect...

Huh?

> -> 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

It's used in Maven itself all over the place.

> -> what interests me is to have the dependencies... and what I get in 
> maven.xml,
> 	    <echo message="blop ${project.getDependencies() == null}"/>
>    says true whereas the project has an amount of dependencies.

You didn't say you wanted to use it in Jelly. Please be clear.

There is a tag for using a POM in Jelly script:

<maven:pom descriptor="/path/to/descriptor"/>

But what exactly are you trying to do? Before you wander off on the
wrong road again. It's not likely you want the dependencies you probably
want the artifacts.

> Am I following the wrong route ?
> 
> Paul
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
-- 
jvz.

Jason van Zyl
jason@zenplex.com
http://tambora.zenplex.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
  
  -- Jacques Ellul, The Technological Society


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Instiating a Project object ( was Re: Executing Maven through Java Webstart)

Posted by Paul Libbrecht <pa...@activemath.org>.
Jason van Zyl wrote:
>>To make that thing short, allow me a quick question: how can I 
>>instantiate a maven Project object ? Oh, and should I switch to the dev 
>>list for that ? (just fearing).
> 
> 
> 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

-> what interests me is to have the dependencies... and what I get in 
maven.xml,
	    <echo message="blop ${project.getDependencies() == null}"/>
   says true whereas the project has an amount of dependencies.

Am I following the wrong route ?

Paul


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Instiating a Project object ( was Re: Executing Maven through Java Webstart)

Posted by Jason van Zyl <ja...@zenplex.com>.
On Mon, 2003-06-30 at 04:00, Paul Libbrecht wrote:
> Paul Libbrecht wrote:
> > I was thinking about writing a servlet that would accept as parameters a 
> > project name and version, as well as a main-class and invocation 
> > attribute. The result would be a jnlp file referring a jar served from 
> > the maven repository (probably following the repository chain defined in 
> > the associated maven) with references to jnlp-described 
> > project-dependencies and their jar(s).
> 
> To make that thing short, allow me a quick question: how can I 
> instantiate a maven Project object ? Oh, and should I switch to the dev 
> list for that ? (just fearing).

import org.apache.maven.MavenUtils;

File f = new File( "project.xml" );
Project p = MavenUtils.getProject( f );


> Paul
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
-- 
jvz.

Jason van Zyl
jason@zenplex.com
http://tambora.zenplex.org

In short, man creates for himself a new religion of a rational
and technical order to justify his work and to be justified in it.
  
  -- Jacques Ellul, The Technological Society


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org


Re: Instiating a Project object ( was Re: Executing Maven through Java Webstart)

Posted by Martin Skopp <sk...@riege.de>.
On Mon, 2003-06-30 at 10:00, Paul Libbrecht wrote:
> To make that thing short, allow me a quick question: how can I 
> instantiate a maven Project object ? Oh, and should I switch to the dev 
> list for that ? (just fearing).

Most (all?) developers are subscribed to maven-user as well...
-- 
Martin Skopp
Riege Software International GmbH
Support: mailto:maint@riege.com, Information: http://www.riege.com
 
This email is intended to be viewed with a nonproportional font.
Public Key on http://www.keyserver.net, Key-ID: 3D4027B5
Fingerprint: 1970 C78D 9A1D 99FA 5CE4  5C0D 29E6 6A95 3D40 27B5



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org