Hi,
Concerning your problem number 1, here is the clean solution:
1) package the tests of your projectCommon in a projectCommon-XX-tests.jar
2) add a dependency in projectSpec_1 and projectSpec_2 with type=test-jar
and scope=test
Read : http://maven.apache.org/guides/mini/guide-attached-tests.html for details
Regards,
Julien
----- Message d'origine ----
> De : oor <[email protected]>
> À : [email protected]
> Envoyé le : Jeu 3 juin 2010, 15h 16min 24s
> Objet : Organization of interdepending projects and super projects
>
>
1)
The following problem is a part problem of the problem in 2)
I have
> three
> projects:
projectSpec_1
projectSpec_2
projectCommon
projectSpec_1
> depends on projectCommon during all phases
projectSpec_2 depends on
> projectCommon during all phases
projectCommon has its own tests, using
> general test utilities contained in
its test sources
projectSpec_1 has its
> own tests, using general test utilities contained in
projectCommon's test
> sources
projectSpec_2 has its own tests, using general test utilities
> contained in
projectCommon's test sources
This gave me problems when
> running tests in projectSpec_1 and projectSpec_2:
Their test sources could
> not be compiled,
as projectCommon's test sources were not
available for
> the test compile.
I solved this in the following way in e.g.
> projectSpec_1's pom.xml:
...
<plugin>
> <groupId>org.codehaus.mojo</groupId>
> <artifactId>build-helper-maven-plugin</artifactId>
> <version>1.5</version>
<executions>
> <execution>
> <id>add-test-resource</id>
>
> <phase>generate-test-resources</phase>
>
> <goals>
> <goal>add-test-resource</goal>
> </goals>
> <configuration>
> <resources>
> <resource>
>
>
<directory>${basedir}/../projectCommon/target/test-classes</directory>
>
> </resource>
> </resources>
> </configuration>
</execution>
> </executions>
</plugin>
...
It works, but I have the
> strong feeling this is best described as a "hack",
not adhering to "best
> practices" of Maven 2.
I guess my project is organized in a non-optimal
> way.
One indication is that the projectSpec_1's pom.xml is dependent on
> the
physical
directory placement of the projectCommon
> project.
2)
The same projects as above, with the additional
> information:
I have two "super-projects in addition to
> 1):
ProjectSuper_1 consists of projectSpec_1, projectSpec_2 and
> projectCommon
projectSpec_1 depends on projectCommon during all
> phases
projectSpec_2 depends on projectCommon during all
> phases
projectCommon
ProjectSuper_2 consists of projectSpec_1,
> projectSpec_3 and projectCommon
projectSpec_1 depends on projectCommon during
> all phases
projectSpec_3 depends on projectCommon during all
> phases
projectCommon
I am not convinced parent-child inheritage is
> part of a correct solution,
as a project can only have one
> parent.
projectCommon cannot inherit ProjectSuper_1 and
> ProjectSuper_2
projectSpec_1 cannot inherit ProjectSuper_1 and
> ProjectSuper_2
3)
I also experience inconveniences when doing the
> coding, as organized just
now.
When working on ProjectSuper_1 (or
> ProjectSuper_2 for that sake), I code in
source belonging
to
> projectSpec_1, projectSpec_2 and projectCommon at the same time. To
compile
> projectSpec_1,
I then first have to compile and install projectCommon, to
> expose its
correct snapshot for projectSpec_1.
To achieve this, I have
> made som DOS bat files, that first installs
projectCommon
and thereafter
> compiles (and possibly installs) projectSpec_1. Using command
files
> to
help me out of the problems occur to me as a
> defeat.
Conclusion:
===========
I am fairly new to Maven2, so I
> have not quite got learned how to
adhere to the Maven2 "best
> practices".
Please give me a hint (or better: more than just a hint) what I
> should do
differently
to origanize my projects better.
--
View this
> message in context:
> href="http://old.nabble.com/Organization-of-interdepending-projects-and-super-projects-tp28767294p28767294.html"
>
> target=_blank
> >http://old.nabble.com/Organization-of-interdepending-projects-and-super-projects-tp28767294p28767294.html
Sent
> from the Maven - Users mailing list archive at
> Nabble.com.
---------------------------------------------------------------------
To
> unsubscribe, e-mail:
> href="mailto:[email protected]">[email protected]
For
> additional commands, e-mail:
> href="mailto:[email protected]">[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]