You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Jochen Wiedmann <jo...@gmail.com> on 2007/01/17 15:14:28 UTC
Same source, different deliverables
Hi,
I'd like to know suggested solutions for the following scenario:
We have a jar file, which is used in different projects since quite
some time. One of the projects is so old, that it is still using Java
1.2. Other projects are using later Java versions, up to 1.5. The jar
files development is mainly driven by the newer projects, but from
time to time we change something in the old sources as well.
In order to use Java 5 features in as many sources as possible, we
have the following solution: The sources are located in three
different folders: A, B and C. An ant script is compiling A and B with
the 1.2 compiler and builds a jar file foo-jdk1.2-<version>.jar.
Likewise, the 1.5 compiler compiles A and C into foo-jdk1.5-<version>.
This has worked fairly well for us.
I would now like to switch the project to Maven 2. A possible approach
would be to have a parent project with three subprojects: A, B and C.
But that won't work too well, because we have cyclic dependencies
between A and B, or A and C. Besides, I am not too happy with that,
because it makes the build fairly complex.
Does anyone have an idea that would allow us to keep the sources in a
single project, but run the Java compiler twice and still create
multiple deliverables?
Thanks,
Jochen
--
How fast can a year go? As fast as your childs first year.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Same source, different deliverables
Posted by Dan Tran <da...@gmail.com>.
However base on your scenario
this is better
source-A
project-B
src/main/java <--- has B
pom.xml <---- attach source A to source root
project-C
src/main/java <--- has C
pom.xml <---- attach source A to source root
-D
-Dan
On 1/17/07, Dan Tran <da...@gmail.com> wrote:
>
> how about place all source in the same folders, then use
> build-helper-maven-plugin to attach
> the source the build project
>
> source
> A
> B
> C
> project-1
> pom.xml <-- attach A and B to source root thru build-helper
>
> ....
>
> however Eclipse IDE is not happy about this approach
>
>
> -D
>
>
>
> On 1/17/07, diroussel <na...@diroussel.xsmail.com> wrote:
> >
> >
> > I'm not an expert, but I'd expect that you could configure the maven
> > compiler
> > plugin to run the compile goal twice with two different configs.
> >
> >
> > <plugin>
> > <groupId>org.apache.maven.plugins</groupId>
> > <artifactId>maven-compiler-plugin</artifactId>
> > <executions>
> > <execution>
> > <id>java-1.2-compile
> > <phase>compile</phase>
> > <goals>
> > <goal>compile</goal>
> > </goals>
> > <configuration>
> > <source>1.2</source>
> > <target>1.2</target>
> > </configuration>
> > </execution>
> > <execution>
> > <id> java-1.5-compile
> > <phase>compile</phase>
> > <goals>
> > <goal>compile</goal>
> > </goals>
> > <configuration>
> > <source> 1.5</source>
> > <target>1.5</target>
> > </configuration>
> > </execution>
> > </executions>
> > </plugin>
> >
> > of course you'll need to override the output locations, and otherwise
> > try to
> > get around the "one artifact per project" default of maven.
> >
> > David
> >
> >
> > Jochen Wiedmann wrote:
> > >
> > > Hi,
> > >
> > > I'd like to know suggested solutions for the following scenario:
> > >
> > > We have a jar file, which is used in different projects since quite
> > > some time. One of the projects is so old, that it is still using Java
> > > 1.2. Other projects are using later Java versions, up to 1.5. The jar
> > > files development is mainly driven by the newer projects, but from
> > > time to time we change something in the old sources as well.
> > >
> > > In order to use Java 5 features in as many sources as possible, we
> > > have the following solution: The sources are located in three
> > > different folders: A, B and C. An ant script is compiling A and B with
> > > the 1.2 compiler and builds a jar file foo-jdk1.2-<version>.jar.
> > > Likewise, the 1.5 compiler compiles A and C into foo-jdk1.5-<version>.
> > > This has worked fairly well for us.
> > >
> > > I would now like to switch the project to Maven 2. A possible approach
> > > would be to have a parent project with three subprojects: A, B and C.
> > > But that won't work too well, because we have cyclic dependencies
> > > between A and B, or A and C. Besides, I am not too happy with that,
> > > because it makes the build fairly complex.
> > >
> > > Does anyone have an idea that would allow us to keep the sources in a
> > > single project, but run the Java compiler twice and still create
> > > multiple deliverables?
> > >
> > > Thanks,
> > >
> > > Jochen
> > >
> > > --
> > > How fast can a year go? As fast as your childs first year.
> > >
> > > ---------------------------------------------------------------------
> > > 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/Same-source%2C-different-deliverables-tf3027481s177.html#a8411497
> > Sent from the Maven - Users mailing list archive at Nabble.com<http://nabble.com/>
> > .
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
>
Re: Same source, different deliverables
Posted by Dan Tran <da...@gmail.com>.
how about place all source in the same folders, then use
build-helper-maven-plugin to attach
the source the build project
source
A
B
C
project-1
pom.xml <-- attach A and B to source root thru build-helper
....
however Eclipse IDE is not happy about this approach
-D
On 1/17/07, diroussel <na...@diroussel.xsmail.com> wrote:
>
>
> I'm not an expert, but I'd expect that you could configure the maven
> compiler
> plugin to run the compile goal twice with two different configs.
>
>
> <plugin>
> <groupId>org.apache.maven.plugins</groupId>
> <artifactId>maven-compiler-plugin</artifactId>
> <executions>
> <execution>
> <id>java-1.2-compile
> <phase>compile</phase>
> <goals>
> <goal>compile</goal>
> </goals>
> <configuration>
> <source>1.2</source>
> <target>1.2</target>
> </configuration>
> </execution>
> <execution>
> <id>java-1.5-compile
> <phase>compile</phase>
> <goals>
> <goal>compile</goal>
> </goals>
> <configuration>
> <source>1.5</source>
> <target>1.5</target>
> </configuration>
> </execution>
> </executions>
> </plugin>
>
> of course you'll need to override the output locations, and otherwise try
> to
> get around the "one artifact per project" default of maven.
>
> David
>
>
> Jochen Wiedmann wrote:
> >
> > Hi,
> >
> > I'd like to know suggested solutions for the following scenario:
> >
> > We have a jar file, which is used in different projects since quite
> > some time. One of the projects is so old, that it is still using Java
> > 1.2. Other projects are using later Java versions, up to 1.5. The jar
> > files development is mainly driven by the newer projects, but from
> > time to time we change something in the old sources as well.
> >
> > In order to use Java 5 features in as many sources as possible, we
> > have the following solution: The sources are located in three
> > different folders: A, B and C. An ant script is compiling A and B with
> > the 1.2 compiler and builds a jar file foo-jdk1.2-<version>.jar.
> > Likewise, the 1.5 compiler compiles A and C into foo-jdk1.5-<version>.
> > This has worked fairly well for us.
> >
> > I would now like to switch the project to Maven 2. A possible approach
> > would be to have a parent project with three subprojects: A, B and C.
> > But that won't work too well, because we have cyclic dependencies
> > between A and B, or A and C. Besides, I am not too happy with that,
> > because it makes the build fairly complex.
> >
> > Does anyone have an idea that would allow us to keep the sources in a
> > single project, but run the Java compiler twice and still create
> > multiple deliverables?
> >
> > Thanks,
> >
> > Jochen
> >
> > --
> > How fast can a year go? As fast as your childs first year.
> >
> > ---------------------------------------------------------------------
> > 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/Same-source%2C-different-deliverables-tf3027481s177.html#a8411497
> 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: Same source, different deliverables
Posted by diroussel <na...@diroussel.xsmail.com>.
I'm not an expert, but I'd expect that you could configure the maven compiler
plugin to run the compile goal twice with two different configs.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<executions>
<execution>
<id>java-1.2-compile
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<source>1.2</source>
<target>1.2</target>
</configuration>
</execution>
<execution>
<id>java-1.5-compile
<phase>compile</phase>
<goals>
<goal>compile</goal>
</goals>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</execution>
</executions>
</plugin>
of course you'll need to override the output locations, and otherwise try to
get around the "one artifact per project" default of maven.
David
Jochen Wiedmann wrote:
>
> Hi,
>
> I'd like to know suggested solutions for the following scenario:
>
> We have a jar file, which is used in different projects since quite
> some time. One of the projects is so old, that it is still using Java
> 1.2. Other projects are using later Java versions, up to 1.5. The jar
> files development is mainly driven by the newer projects, but from
> time to time we change something in the old sources as well.
>
> In order to use Java 5 features in as many sources as possible, we
> have the following solution: The sources are located in three
> different folders: A, B and C. An ant script is compiling A and B with
> the 1.2 compiler and builds a jar file foo-jdk1.2-<version>.jar.
> Likewise, the 1.5 compiler compiles A and C into foo-jdk1.5-<version>.
> This has worked fairly well for us.
>
> I would now like to switch the project to Maven 2. A possible approach
> would be to have a parent project with three subprojects: A, B and C.
> But that won't work too well, because we have cyclic dependencies
> between A and B, or A and C. Besides, I am not too happy with that,
> because it makes the build fairly complex.
>
> Does anyone have an idea that would allow us to keep the sources in a
> single project, but run the Java compiler twice and still create
> multiple deliverables?
>
> Thanks,
>
> Jochen
>
> --
> How fast can a year go? As fast as your childs first year.
>
> ---------------------------------------------------------------------
> 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/Same-source%2C-different-deliverables-tf3027481s177.html#a8411497
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