You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Michael Owen <mi...@hotmail.com> on 2005/07/25 19:04:14 UTC

[M1] Using source files of another project

Hi,

I'm using Maven 1.0.2 and on one maven project I need to use the java source 
files of another maven project. Any ideas how I can do it in the best way? 
(ie. in one maven project, it's source files references the source files in 
another project)

I need to keep the two sets of maven source files separate.

Thanks,

Mike



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


Re: [M1] Using source files of another project

Posted by Jamie Bisotti <jb...@gmail.com>.
On 7/26/05, Michael Owen <mi...@hotmail.com> wrote:
> 
> Thanks very much for your help. I'll try to describe the use case. :)
> 
> In a similar scenerio, I have:
> 
> mainprojectfolder:
> +folder1
> +folder2
> +folder3
>     + src
>        + net
>           + test
>               + File1.java
> +folder4
> +globalbuildfolder
> 
> Each folder has an Ant build.xml file, where globalbuildfolder is a folder
> where global properties go, creates a EAR from all the folders etc.
> 
> I'm converting to Maven 1.0.2, and so I'm going to have a project.xml in
> each folder1, 2 etc, which all <extend> the project.xml globalbuildfolder. I
> then have a case where the java src code in folder2 relies on the java src
> code in folder3. What I mean by this is that a class in folder2 imports a
> class which is in folder3 (like above, a class in folder2 does: import
> net.test.File1;)
> 
> As you can appreciate because I am coverting to Maven 1.0.2, and people have
> been and are working on these projects, I can't restructure the
> folders/filesystem etc.
> 
> Many thanks,
> 
> Michael Owen
> 
> <br><br><br>>From: Brett Porter
> <br...@gmail.com><br>>Reply-To: Brett Porter
> <br...@gmail.com><br>>To: Maven Users List
> <us...@maven.apache.org><br>>Subject: Re: [M1] Using source files
> of another project<br>>Date: Tue, 26 Jul 2005 22:19:33
> +1000<br>><br>>We usually discourage coupling projects like that - it
> breaks its<br>>encapsulation (unless you build a source JAR from the
> first project<br>>and depend on it in the second to extract and then use
> for compilation<br>>- but that sounds very long
> winded).<br>><br>>What is the specific use case you are trying to
> solve?<br>><br>>- Brett<br>><br>>On 7/26/05, Michael Owen
> <mi...@hotmail.com> wrote:<br>> > Hi,<br>>
> ><br>> > I'm using Maven 1.0.2 and on one maven project I need to
> use the java source<br>> > files of another maven project. Any ideas
> how I can do it in the best way?<br>> > (ie. in one maven project,
> it's source files references the source files in<br>> > another
> project)<br>> ><br>> > I need to keep the two sets of maven
> source files separate.<br>> ><br>> > Thanks,<br>>
> ><br>> > Mike<br>> ><br>> ><br>> ><br>> >
> ---------------------------------------------------------------------<br>>
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org<br>> >
> For additional commands, e-mail: users-help@maven.apache.org<br>>
> ><br>>
> ><br>><br>>---------------------------------------------------------------------<br>>To
> unsubscribe, e-mail: users-unsubscribe@maven.apache.org<br>>For
> additional commands, e-mail: users-help@maven.apache.org<br>><br>
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
> 

So, you aren't dependent on the source (.java), you are dependent on
the compiled code.  You will need to put the dependency on folder2 in
folder3's POM; and the dependency on folder1 in folder2's POM.  Then
you will need to run the multiproject artifact-install goal.  Maven
will determine which folder needs to be built first (folder1?),
compile it, JAR it, and copy it to your local repository.  Then, it
will decide that folder2 needs to be built next, it will use the
folder1 jar from the repository when compiling folder2, and so on...

HTHs,
  Jamie

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


Re: [M1] Using source files of another project

Posted by Michael Owen <mi...@hotmail.com>.
Thanks very much for your help. I'll try to describe the use case. :)

In a similar scenerio, I have:

mainprojectfolder:
+folder1
+folder2
+folder3
    + src
       + net
          + test
              + File1.java
+folder4
+globalbuildfolder

Each folder has an Ant build.xml file, where globalbuildfolder is a folder 
where global properties go, creates a EAR from all the folders etc.

I'm converting to Maven 1.0.2, and so I'm going to have a project.xml in 
each folder1, 2 etc, which all <extend> the project.xml globalbuildfolder. I 
then have a case where the java src code in folder2 relies on the java src 
code in folder3. What I mean by this is that a class in folder2 imports a 
class which is in folder3 (like above, a class in folder2 does: import 
net.test.File1;)

As you can appreciate because I am coverting to Maven 1.0.2, and people have 
been and are working on these projects, I can't restructure the 
folders/filesystem etc.

Many thanks,

Michael Owen

<br><br><br>&gt;From: Brett Porter 
&lt;brett.porter@gmail.com&gt;<br>&gt;Reply-To: Brett Porter 
&lt;brett.porter@gmail.com&gt;<br>&gt;To: Maven Users List 
&lt;users@maven.apache.org&gt;<br>&gt;Subject: Re: [M1] Using source files 
of another project<br>&gt;Date: Tue, 26 Jul 2005 22:19:33 
+1000<br>&gt;<br>&gt;We usually discourage coupling projects like that - it 
breaks its<br>&gt;encapsulation (unless you build a source JAR from the 
first project<br>&gt;and depend on it in the second to extract and then use 
for compilation<br>&gt;- but that sounds very long 
winded).<br>&gt;<br>&gt;What is the specific use case you are trying to 
solve?<br>&gt;<br>&gt;- Brett<br>&gt;<br>&gt;On 7/26/05, Michael Owen 
&lt;michaelowenuk@hotmail.com&gt; wrote:<br>&gt; &gt; Hi,<br>&gt; 
&gt;<br>&gt; &gt; I'm using Maven 1.0.2 and on one maven project I need to 
use the java source<br>&gt; &gt; files of another maven project. Any ideas 
how I can do it in the best way?<br>&gt; &gt; (ie. in one maven project, 
it's source files references the source files in<br>&gt; &gt; another 
project)<br>&gt; &gt;<br>&gt; &gt; I need to keep the two sets of maven 
source files separate.<br>&gt; &gt;<br>&gt; &gt; Thanks,<br>&gt; 
&gt;<br>&gt; &gt; Mike<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt;<br>&gt; &gt; 
---------------------------------------------------------------------<br>&gt; 
&gt; To unsubscribe, e-mail: users-unsubscribe@maven.apache.org<br>&gt; &gt; 
For additional commands, e-mail: users-help@maven.apache.org<br>&gt; 
&gt;<br>&gt; 
&gt;<br>&gt;<br>&gt;---------------------------------------------------------------------<br>&gt;To 
unsubscribe, e-mail: users-unsubscribe@maven.apache.org<br>&gt;For 
additional commands, e-mail: users-help@maven.apache.org<br>&gt;<br>



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


Re: [M1] Using source files of another project

Posted by Brett Porter <br...@gmail.com>.
We usually discourage coupling projects like that - it breaks its
encapsulation (unless you build a source JAR from the first project
and depend on it in the second to extract and then use for compilation
- but that sounds very long winded).

What is the specific use case you are trying to solve?

- Brett

On 7/26/05, Michael Owen <mi...@hotmail.com> wrote:
> Hi,
> 
> I'm using Maven 1.0.2 and on one maven project I need to use the java source
> files of another maven project. Any ideas how I can do it in the best way?
> (ie. in one maven project, it's source files references the source files in
> another project)
> 
> I need to keep the two sets of maven source files separate.
> 
> Thanks,
> 
> Mike
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
> 
>

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