You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by TH Lim <ss...@yahoo.com> on 2006/03/12 07:22:31 UTC

Compile Sources Specific to Its Subproject But Not Sources They Depend On

Hi,

I have a directory structure that looks something like
this

-Projects/
  -ProjectA/
    +build/
    +src/
      +package1
  -ProjectB/
    +build/
    +src/
      +package2
  

I'm using Eclipse 3.x and have set each subproject
source to be built with in each subproject build
directory i.e. classes from ProjectA/src will be
compiled into ProjectA/build and ProjectB/src will be
compiled into ProjectB/build. 

Some of the sources in ProjectA/src depends on sources
in ProjectB/src and vice versa

The classes generated by Eclipse are specific to its
subproject i.e. in ProjectA/build I will only see
package1 and the classes benefit it and package2 is
NOT generated in this subproject. The same goes for
ProjectB.

Is there anyway I could do the same for Ant? This is
because Ant generates both packages in ProjectA/build
directory. Is there a 3rd party library that allows me
to do so? 

I'm using Ant 1.6.5.

Thanks

/lim/


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Compile Sources Specific to Its Subproject But Not Sources They Depend On

Posted by TH Lim <ss...@yahoo.com>.
I totally agreed with you for not having circular
dependencies between projects. Sometimes, you can't
say much when you inherit codes from the contractors
which you have no control over. Unless I bite the
bullet and break all circular dependencies in the code
there is nothing much I can do. Other option is to
have Eclipse like compiler.

I am under the impression that Eclipse uses SUN
compiler because it uses the libraries i.e. tools.jar
from the JDK directory. Am I wrong?

--- Dominique Devienne <dd...@gmail.com> wrote:

> Hmmm, I don't know of any way to have the SUN
> compiler generate the
> classes the way you describe if you really have
> circular dependencies
> between the 2 projects. Eclipse must be using its
> own compiler to do
> that.
> 
> Again, assuming you really have circular
> dependencies, you can't
> compile projectA and projectB independently without
> having either's
> src/ dir in the sourcepath, or the compiled classes
> of one in the
> classpath, but to have the latter you end up with a
> chicken-and-egg
> pb, while the former implies (with SUN's compiler)
> that some of the
> other project classes will be output in the first
> projects build/ dir.
> 
> I hope I am making sense to you ;-) Good luck,
> 
> "avoid circular dependencies between projects" (tm)
> --DD
> 
> On 3/12/06, TH Lim <ss...@yahoo.com> wrote:
> > Hi,
> >
> > I have a directory structure that looks something
> like
> > this
> >
> > -Projects/
> >  -ProjectA/
> >    +build/
> >    +src/
> >      +package1
> >  -ProjectB/
> >    +build/
> >    +src/
> >      +package2
> >
> >
> > I'm using Eclipse 3.x and have set each subproject
> > source to be built with in each subproject build
> > directory i.e. classes from ProjectA/src will be
> > compiled into ProjectA/build and ProjectB/src will
> be
> > compiled into ProjectB/build.
> >
> > Some of the sources in ProjectA/src depends on
> sources
> > in ProjectB/src and vice versa
> >
> > The classes generated by Eclipse are specific to
> its
> > subproject i.e. in ProjectA/build I will only see
> > package1 and the classes benefit it and package2
> is
> > NOT generated in this subproject. The same goes
> for
> > ProjectB.
> >
> > Is there anyway I could do the same for Ant? This
> is
> > because Ant generates both packages in
> ProjectA/build
> > directory. Is there a 3rd party library that
> allows me
> > to do so?
> >
> > I'm using Ant 1.6.5.
> >
> > Thanks
> >
> > /lim/
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam?  Yahoo! Mail has the best spam
> protection around
> > http://mail.yahoo.com
> >
> >
>
---------------------------------------------------------------------
> > To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> > For additional commands, e-mail:
> user-help@ant.apache.org
> >
> >
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: Compile Sources Specific to Its Subproject But Not Sources They Depend On

Posted by Dominique Devienne <dd...@gmail.com>.
Hmmm, I don't know of any way to have the SUN compiler generate the
classes the way you describe if you really have circular dependencies
between the 2 projects. Eclipse must be using its own compiler to do
that.

Again, assuming you really have circular dependencies, you can't
compile projectA and projectB independently without having either's
src/ dir in the sourcepath, or the compiled classes of one in the
classpath, but to have the latter you end up with a chicken-and-egg
pb, while the former implies (with SUN's compiler) that some of the
other project classes will be output in the first projects build/ dir.

I hope I am making sense to you ;-) Good luck,

"avoid circular dependencies between projects" (tm) --DD

On 3/12/06, TH Lim <ss...@yahoo.com> wrote:
> Hi,
>
> I have a directory structure that looks something like
> this
>
> -Projects/
>  -ProjectA/
>    +build/
>    +src/
>      +package1
>  -ProjectB/
>    +build/
>    +src/
>      +package2
>
>
> I'm using Eclipse 3.x and have set each subproject
> source to be built with in each subproject build
> directory i.e. classes from ProjectA/src will be
> compiled into ProjectA/build and ProjectB/src will be
> compiled into ProjectB/build.
>
> Some of the sources in ProjectA/src depends on sources
> in ProjectB/src and vice versa
>
> The classes generated by Eclipse are specific to its
> subproject i.e. in ProjectA/build I will only see
> package1 and the classes benefit it and package2 is
> NOT generated in this subproject. The same goes for
> ProjectB.
>
> Is there anyway I could do the same for Ant? This is
> because Ant generates both packages in ProjectA/build
> directory. Is there a 3rd party library that allows me
> to do so?
>
> I'm using Ant 1.6.5.
>
> Thanks
>
> /lim/
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Compile Sources Specific to Its Subproject But Not Sources They Depend On

Posted by TH Lim <ss...@yahoo.com>.
I have individual build.xml in each sub project. The
problem is I need to add sourcepath in each build.xml
to refer to the sources in the other project. As a
result, the sources from the other sub project are
compiled into this sub project and vice versa. This is
something I don't want.

What can I say, I inherited the code :( My only
concern now is to have the codes compiled and running
ASAP. For the time being, I'm using Eclipse IDE to
compile the codes and use Ant to jar the classes in
each sub project as an individual jar file.

--- Stephen McConnell <mc...@dpml.net> wrote:

>  
> 
> > -----Original Message-----
> > From: TH Lim [mailto:sshark97@yahoo.com] 
> > Sent: Sunday, 12 March 2006 4:53 PM
> > To: user@ant.apache.org
> > Subject: Compile Sources Specific to Its
> Subproject But Not 
> > Sources They Depend On
> > 
> > Hi,
> > 
> > I have a directory structure that looks something
> like this
> > 
> > -Projects/
> >   -ProjectA/
> >     +build/
> >     +src/
> >       +package1
> >   -ProjectB/
> >     +build/
> >     +src/
> >       +package2
> >   
> > 
> > I'm using Eclipse 3.x and have set each subproject
> source to 
> > be built with in each subproject build directory
> i.e. classes 
> > from ProjectA/src will be compiled into
> ProjectA/build and 
> > ProjectB/src will be compiled into ProjectB/build.
> 
> > 
> > Some of the sources in ProjectA/src depends on
> sources in 
> > ProjectB/src and vice versa
> > 
> > The classes generated by Eclipse are specific to
> its 
> > subproject i.e. in ProjectA/build I will only see
> > package1 and the classes benefit it and package2
> is NOT 
> > generated in this subproject. The same goes for
> ProjectB.
> > 
> > Is there anyway I could do the same for Ant? This
> is because 
> > Ant generates both packages in ProjectA/build
> directory. 
> 
> This does not sound right.  Ant's invocation of the
> javac task will place
> classes into the destination directory that you
> specify.  From what your
> saying here it sounds like your build file is
> declaring that 
> "ProjectA/build" is the destination directory for
> both projects.
> 
> Concerning the circular dependencies - you need
> factor out what is common
> between the two projects and push this into a new
> separate project that is
> consumed by A and B.
> 
> Cheers, Steve.
> 
> 
> 
>
---------------------------------------------------------------------
> To unsubscribe, e-mail:
> user-unsubscribe@ant.apache.org
> For additional commands, e-mail:
> user-help@ant.apache.org
> 
> 


__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


RE: Compile Sources Specific to Its Subproject But Not Sources They Depend On

Posted by Stephen McConnell <mc...@dpml.net>.
 

> -----Original Message-----
> From: TH Lim [mailto:sshark97@yahoo.com] 
> Sent: Sunday, 12 March 2006 4:53 PM
> To: user@ant.apache.org
> Subject: Compile Sources Specific to Its Subproject But Not 
> Sources They Depend On
> 
> Hi,
> 
> I have a directory structure that looks something like this
> 
> -Projects/
>   -ProjectA/
>     +build/
>     +src/
>       +package1
>   -ProjectB/
>     +build/
>     +src/
>       +package2
>   
> 
> I'm using Eclipse 3.x and have set each subproject source to 
> be built with in each subproject build directory i.e. classes 
> from ProjectA/src will be compiled into ProjectA/build and 
> ProjectB/src will be compiled into ProjectB/build. 
> 
> Some of the sources in ProjectA/src depends on sources in 
> ProjectB/src and vice versa
> 
> The classes generated by Eclipse are specific to its 
> subproject i.e. in ProjectA/build I will only see
> package1 and the classes benefit it and package2 is NOT 
> generated in this subproject. The same goes for ProjectB.
> 
> Is there anyway I could do the same for Ant? This is because 
> Ant generates both packages in ProjectA/build directory. 

This does not sound right.  Ant's invocation of the javac task will place
classes into the destination directory that you specify.  From what your
saying here it sounds like your build file is declaring that 
"ProjectA/build" is the destination directory for both projects.

Concerning the circular dependencies - you need factor out what is common
between the two projects and push this into a new separate project that is
consumed by A and B.

Cheers, Steve.



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org