You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by CheapLisa <li...@purpleblade.net> on 2008/12/10 21:35:47 UTC
How to have a single log4j.xml file in a multi-module project?
I have a project with many modules (over 30) and some are nested 2-3 deep.
With Maven / Log4J I have to put two log4j.xml files in every module:
src/main/resources/log4j.xml
src/test/resources/log4j.xml
This is usually the same file over and over again.
1)
How can I have one single log4j.xml file for all tests
(src/test/resources/) and one log4j.xml file for
all code (/src/main/resources/)
2)
How can I have one single log4j.xml file for all modules in the project?
thanks
L
--
View this message in context: http://www.nabble.com/How-to-have-a-single-log4j.xml-file-in-a-multi-module-project--tp20943438p20943438.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How to have a single log4j.xml file in a multi-module project?
Posted by Stephen Connolly <st...@gmail.com>.
google is your friend
look up cyclic reference
when you understand what one of them is, have a look at your project
and see if you have a cyclic reference
here is a hint for you: the parent section of a pom does not have to
be referencing the parent folders pom
Sent from my iPod
On 13 Dec 2008, at 03:57, CheapLisa <li...@purpleblade.net> wrote:
>
> OK, when I do this I get a cyclic reference and it does not work.
>
> I have:
> <project_root>/pom.xml <= this is referred to as my
> "parent pom"
>
> and I have a sub-module for logging (has only the
> /src/main/resources/log4j.xml
> <project_root>/utils/logging/pom.xml
> <project_root>/utils/logging/src/main/resources/log4j.xml
>
> In the utils/logging/pom.xml I have this included
> <dependency>
> <groupId>log4j</groupId>
> <artifactId>log4j</artifactId>
> <version>1.2.15</version>
> <scope>compile</scope>
> </dependency>
>
> so to use in every other project, I put in the top level (parent
> pom) this
> dependency on
> the logging sub-module:
>
> <dependencies>
> <dependency>
> <groupId>com.acme<groupId>
> <artifactId>logging</artifactId>
> <version>1.0</version>
> <scope>compile</scope>
> </dependency>
> </dependencies>
>
>
> and I do not touch any other module anywhere because in every pom
> everywhere I have
> the following reference to the parent pom:
>
> <parent>
> <groupId>com.acme</groupId>
> <artifactId>acme.parent-pom</artifactId>
> <version>1.0</version>
> </parent>
>
> so the parent pom dependency is logging-1.0.jar but the first thing
> it tries
> to compile also has
> that dependency.
>
>
> ---
> + Error stacktraces are turned on.
> [INFO] Scanning for projects...
> [INFO]
> ---
> ---------------------------------------------------------------------
> [ERROR] BUILD FAILURE
> [INFO]
> ---
> ---------------------------------------------------------------------
> [INFO] The projects in the reactor contain a cyclic reference: Edge
> between
> 'Vertex{label='com.avoce
> nt.amp.patch:utils.logging'}' and
> 'Vertex{label='com.acme.patch:utils.logging'}' introduces t
> o cycle in the graph com.acme:utils.logging -->
> com.acme.patch:utils.logging
> [INFO]
> ---
> ---------------------------------------------------------------------
> [INFO] Trace
> org.apache.maven.BuildFailureException: The projects in the reactor
> contain
> a cyclic reference: Edge
> between 'Vertex{label='com.acme.patch:utils.logging'}' and
> 'Vertex{label='com.acme:utils.logging'}' introduces to cycle in the
> graph
> com.acmepatch:utils.logging --> com.av
> ocent.amp.patch:utils.logging
> at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:
> 310)
> at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
> at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
>
>
>
> Stephen Connolly-2 wrote:
>>
>> In theory, yes, though I have not tried it myself
>>
>> 2008/12/11 CheapLisa <li...@purpleblade.net>
>>
>>>
>>> so I could make a module for it say logging/pom.xml and then put a
>>> <dependency> to it in a parent pom that all sub-modules have as a
>>> parent-pom
>>> and this would work?
>>>
>>> thanks
>>>
>>> L
>>>
>>>
>>>
>>> Stephen Connolly-2 wrote:
>>>>
>>>> put it in a jar file (make a module just for it) and add that
>>>> module
>>>> as a dependency to all the projects that need it
>>>>
>>>> Sent from my iPod
>>>>
>>>> On 10 Dec 2008, at 20:35, CheapLisa <li...@purpleblade.net> wrote:
>>>>
>>>>>
>>>>>
>>>>> I have a project with many modules (over 30) and some are nested
>>>>> 2-3
>>>>> deep.
>>>>>
>>>>> With Maven / Log4J I have to put two log4j.xml files in every
>>>>> module:
>>>>> src/main/resources/log4j.xml
>>>>> src/test/resources/log4j.xml
>>>>>
>>>>> This is usually the same file over and over again.
>>>>>
>>>>> 1)
>>>>> How can I have one single log4j.xml file for all tests
>>>>> (src/test/resources/) and one log4j.xml file for
>>>>> all code (/src/main/resources/)
>>>>>
>>>>> 2)
>>>>> How can I have one single log4j.xml file for all modules in the
>>>>> project?
>>>>>
>>>>> thanks
>>>>>
>>>>> L
>>>>> --
>>>>> View this message in context:
>>>>>
>>> http://www.nabble.com/How-to-have-a-single-log4j.xml-file-in-a-multi-module-project--tp20943438p20943438.html
>>>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---
>>>>> ------------------------------------------------------------------
>>>>> 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
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/How-to-have-a-single-log4j.xml-file-in-a-multi-module-project--tp20943438p20964994.html
>>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>>
>>>
>>> ---
>>> ------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>>> For additional commands, e-mail: users-help@maven.apache.org
>>>
>>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/How-to-have-a-single-log4j.xml-file-in-a-multi-module-project--tp20943438p20987209.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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
Re: How to have a single log4j.xml file in a multi-module project?
Posted by CheapLisa <li...@purpleblade.net>.
OK, when I do this I get a cyclic reference and it does not work.
I have:
<project_root>/pom.xml <= this is referred to as my "parent pom"
and I have a sub-module for logging (has only the
/src/main/resources/log4j.xml
<project_root>/utils/logging/pom.xml
<project_root>/utils/logging/src/main/resources/log4j.xml
In the utils/logging/pom.xml I have this included
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.15</version>
<scope>compile</scope>
</dependency>
so to use in every other project, I put in the top level (parent pom) this
dependency on
the logging sub-module:
<dependencies>
<dependency>
<groupId>com.acme<groupId>
<artifactId>logging</artifactId>
<version>1.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
and I do not touch any other module anywhere because in every pom
everywhere I have
the following reference to the parent pom:
<parent>
<groupId>com.acme</groupId>
<artifactId>acme.parent-pom</artifactId>
<version>1.0</version>
</parent>
so the parent pom dependency is logging-1.0.jar but the first thing it tries
to compile also has
that dependency.
---
+ Error stacktraces are turned on.
[INFO] Scanning for projects...
[INFO]
------------------------------------------------------------------------
[ERROR] BUILD FAILURE
[INFO]
------------------------------------------------------------------------
[INFO] The projects in the reactor contain a cyclic reference: Edge between
'Vertex{label='com.avoce
nt.amp.patch:utils.logging'}' and
'Vertex{label='com.acme.patch:utils.logging'}' introduces t
o cycle in the graph com.acme:utils.logging --> com.acme.patch:utils.logging
[INFO]
------------------------------------------------------------------------
[INFO] Trace
org.apache.maven.BuildFailureException: The projects in the reactor contain
a cyclic reference: Edge
between 'Vertex{label='com.acme.patch:utils.logging'}' and
'Vertex{label='com.acme:utils.logging'}' introduces to cycle in the graph
com.acmepatch:utils.logging --> com.av
ocent.amp.patch:utils.logging
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:310)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:126)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:282)
Stephen Connolly-2 wrote:
>
> In theory, yes, though I have not tried it myself
>
> 2008/12/11 CheapLisa <li...@purpleblade.net>
>
>>
>> so I could make a module for it say logging/pom.xml and then put a
>> <dependency> to it in a parent pom that all sub-modules have as a
>> parent-pom
>> and this would work?
>>
>> thanks
>>
>> L
>>
>>
>>
>> Stephen Connolly-2 wrote:
>> >
>> > put it in a jar file (make a module just for it) and add that module
>> > as a dependency to all the projects that need it
>> >
>> > Sent from my iPod
>> >
>> > On 10 Dec 2008, at 20:35, CheapLisa <li...@purpleblade.net> wrote:
>> >
>> >>
>> >>
>> >> I have a project with many modules (over 30) and some are nested 2-3
>> >> deep.
>> >>
>> >> With Maven / Log4J I have to put two log4j.xml files in every module:
>> >> src/main/resources/log4j.xml
>> >> src/test/resources/log4j.xml
>> >>
>> >> This is usually the same file over and over again.
>> >>
>> >> 1)
>> >> How can I have one single log4j.xml file for all tests
>> >> (src/test/resources/) and one log4j.xml file for
>> >> all code (/src/main/resources/)
>> >>
>> >> 2)
>> >> How can I have one single log4j.xml file for all modules in the
>> >> project?
>> >>
>> >> thanks
>> >>
>> >> L
>> >> --
>> >> View this message in context:
>> >>
>> http://www.nabble.com/How-to-have-a-single-log4j.xml-file-in-a-multi-module-project--tp20943438p20943438.html
>> >> Sent from the Maven - Users mailing list archive at Nabble.com.
>> >>
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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
>> >
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-have-a-single-log4j.xml-file-in-a-multi-module-project--tp20943438p20964994.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
>
--
View this message in context: http://www.nabble.com/How-to-have-a-single-log4j.xml-file-in-a-multi-module-project--tp20943438p20987209.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How to have a single log4j.xml file in a multi-module project?
Posted by Stephen Connolly <st...@gmail.com>.
In theory, yes, though I have not tried it myself
2008/12/11 CheapLisa <li...@purpleblade.net>
>
> so I could make a module for it say logging/pom.xml and then put a
> <dependency> to it in a parent pom that all sub-modules have as a
> parent-pom
> and this would work?
>
> thanks
>
> L
>
>
>
> Stephen Connolly-2 wrote:
> >
> > put it in a jar file (make a module just for it) and add that module
> > as a dependency to all the projects that need it
> >
> > Sent from my iPod
> >
> > On 10 Dec 2008, at 20:35, CheapLisa <li...@purpleblade.net> wrote:
> >
> >>
> >>
> >> I have a project with many modules (over 30) and some are nested 2-3
> >> deep.
> >>
> >> With Maven / Log4J I have to put two log4j.xml files in every module:
> >> src/main/resources/log4j.xml
> >> src/test/resources/log4j.xml
> >>
> >> This is usually the same file over and over again.
> >>
> >> 1)
> >> How can I have one single log4j.xml file for all tests
> >> (src/test/resources/) and one log4j.xml file for
> >> all code (/src/main/resources/)
> >>
> >> 2)
> >> How can I have one single log4j.xml file for all modules in the
> >> project?
> >>
> >> thanks
> >>
> >> L
> >> --
> >> View this message in context:
> >>
> http://www.nabble.com/How-to-have-a-single-log4j.xml-file-in-a-multi-module-project--tp20943438p20943438.html
> >> Sent from the Maven - Users mailing list archive at Nabble.com.
> >>
> >>
> >> ---------------------------------------------------------------------
> >> 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
> >
> >
> >
>
> --
> View this message in context:
> http://www.nabble.com/How-to-have-a-single-log4j.xml-file-in-a-multi-module-project--tp20943438p20964994.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: How to have a single log4j.xml file in a multi-module project?
Posted by CheapLisa <li...@purpleblade.net>.
so I could make a module for it say logging/pom.xml and then put a
<dependency> to it in a parent pom that all sub-modules have as a parent-pom
and this would work?
thanks
L
Stephen Connolly-2 wrote:
>
> put it in a jar file (make a module just for it) and add that module
> as a dependency to all the projects that need it
>
> Sent from my iPod
>
> On 10 Dec 2008, at 20:35, CheapLisa <li...@purpleblade.net> wrote:
>
>>
>>
>> I have a project with many modules (over 30) and some are nested 2-3
>> deep.
>>
>> With Maven / Log4J I have to put two log4j.xml files in every module:
>> src/main/resources/log4j.xml
>> src/test/resources/log4j.xml
>>
>> This is usually the same file over and over again.
>>
>> 1)
>> How can I have one single log4j.xml file for all tests
>> (src/test/resources/) and one log4j.xml file for
>> all code (/src/main/resources/)
>>
>> 2)
>> How can I have one single log4j.xml file for all modules in the
>> project?
>>
>> thanks
>>
>> L
>> --
>> View this message in context:
>> http://www.nabble.com/How-to-have-a-single-log4j.xml-file-in-a-multi-module-project--tp20943438p20943438.html
>> Sent from the Maven - Users mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> 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
>
>
>
--
View this message in context: http://www.nabble.com/How-to-have-a-single-log4j.xml-file-in-a-multi-module-project--tp20943438p20964994.html
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: How to have a single log4j.xml file in a multi-module project?
Posted by Stephen Connolly <st...@gmail.com>.
put it in a jar file (make a module just for it) and add that module
as a dependency to all the projects that need it
Sent from my iPod
On 10 Dec 2008, at 20:35, CheapLisa <li...@purpleblade.net> wrote:
>
>
> I have a project with many modules (over 30) and some are nested 2-3
> deep.
>
> With Maven / Log4J I have to put two log4j.xml files in every module:
> src/main/resources/log4j.xml
> src/test/resources/log4j.xml
>
> This is usually the same file over and over again.
>
> 1)
> How can I have one single log4j.xml file for all tests
> (src/test/resources/) and one log4j.xml file for
> all code (/src/main/resources/)
>
> 2)
> How can I have one single log4j.xml file for all modules in the
> project?
>
> thanks
>
> L
> --
> View this message in context: http://www.nabble.com/How-to-have-a-single-log4j.xml-file-in-a-multi-module-project--tp20943438p20943438.html
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> 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