You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Tomek Maciejewski <to...@gmail.com> on 2008/09/25 06:51:10 UTC
building two artifacts with shared source code
Hi,
I have some problem. I am developing an application which should work
on mobile devices and desktop. The problem is that I don't want to
duplicate the common code. So I createdd a project "common" which
contains common part of code. I also have a mobile project and desktop
project, both of them depends on this "common". The real architecture
is much more complicated but I think the one described below easily
shows my problem. The problem is that a "common" part must be compiled
in diferent way for mobile and for desktop. I don't know if I it is
possible to compile it one time for example with mobile compilator and
it will works on desktopalso. Maybe it will work but I don't think
that it is the right way to do it, and problem with this solution is,
that for mobile devices I have to preverify classes, to preverify it
with pyx4me plugin I add all the project depndencies inside a
preverified jar to satisfy the preverification constraint (to have all
used classes in preverifaction classpath). So the jars after
preverification contain all the dependencies inside, i think it is
reallly bad solution. Maybe it is possible to somehow unpack the
dependencies add it to preverifaction classpath, preverify only
project classes and pack them to the jar, without dependencies. But I
still don't know if I it is possible to use these preverified classes
at desktop as well, and even if it is ok, I am still not sure if it is
a good solution to use such a modified classes at desktops. So, I
created a second project and gave it a relative path to sources from
first one. So one of them have generated artifact for desktop, and the
second one for mobile. But it still stinks. Generaly using the
relative path to have an acces to the source of the project at the
same level is rather an example of 'bad design'. Actually not only for
me, Eclispe and its Mobile Tools for Java plugin also doesn't deal
with these relative path, so even if I chekout all the projects, the
source folder wouldn't be resolved because it is placed out of of the
project directory. So it is still bad solution for me. I also tried to
place two pom's in one directory, but the parent projects accept only
modules with pom.xml file, I cannot point that in the directory
'child' there are two different modules with poms: pom1.xml and
pom2.xml. So it still sucks, because for the IDE it would be great to
share the same sources between two projects, without using relative
path to other projects which are on the same hierarchy level or higer.
Maybe it is possible to somehow define more than one artifact in one
pom.xml? But actually I don't think it is possible, so maybe some of
you have met with similar problem and could tell me how to deal with
it?
Cheers,
Tomek
P.S
I have one more question. Let's assume that I deployed some artifact.
Some people have used it so they have copy of it in local repository.
Now I change something in artifact and deploy it with the same version
number. Will all the people which have a copy of previous version in
local repository still use old version, or maybe maven will see that
there is a new version of this library (with the same version number
as previous) and automatically download it from remote repository
during the building?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: building two artifacts with shared source code
Posted by Tomasz Pik <to...@gmail.com>.
On Thu, Sep 25, 2008 at 6:51 AM, Tomek Maciejewski
<to...@gmail.com> wrote:
> P.S
> I have one more question. Let's assume that I deployed some artifact.
> Some people have used it so they have copy of it in local repository.
> Now I change something in artifact and deploy it with the same version
> number. Will all the people which have a copy of previous version in
> local repository still use old version, or maybe maven will see that
> there is a new version of this library (with the same version number
> as previous) and automatically download it from remote repository
> during the building?
It's possible to force maven to reload dependencies, see
http://maven.apache.org/plugins/maven-dependency-plugin/purge-local-repository-mojo.html
But it's a very bad idea.
If you release something with given version number, then, if
you need to make a fix, release new version and let users know,
that they should change version in their projects, not
're-download' artifacts from repositories.
I do not know for sure but I think that repository managers
(archiva, nexus) will not 're-download' your 're-released' projects
if you do such a trick.
Also - perhaps this will help:
http://mojo.codehaus.org/versions-maven-plugin/display-dependency-updates-mojo.html
Regards,
Tomek
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: building two artifacts with shared source code
Posted by Wayne Fay <wa...@gmail.com>.
Different platforms are usually addressed by adding a <classifier> to
the artifact, eg Windows, MacOSX, or in your case, J2ME.
You may note a strong correlation between the "shorter paragraph" in
your PS and the "number of responses". Your first question is simply
too long and convoluted, with no paragraph breaks etc, for 90% of the
people on this list to read. Bear in mind -- very few if any people
here are getting paid to read and respond to these emails.
Go back, think about what you want to say/do, and post it much more
succinctly and you will probably get a better response.
Wayne
On Thu, Sep 25, 2008 at 10:06 AM, Tomek Maciejewski
<to...@gmail.com> wrote:
> Thanks guys, now I understand that under the development I should use
> snapshots, it sounds pretty good. Do some of you know how to deal with
> the same project for different platforms. That's my first question and
> I am really intersted how it is done by experts?
>
> Tomek
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: building two artifacts with shared source code
Posted by Tomek Maciejewski <to...@gmail.com>.
Thanks guys, now I understand that under the development I should use
snapshots, it sounds pretty good. Do some of you know how to deal with
the same project for different platforms. That's my first question and
I am really intersted how it is done by experts?
Tomek
2008/9/25 Wendy Smoak <ws...@gmail.com>:
> On Wed, Sep 24, 2008 at 9:51 PM, Tomek Maciejewski
> <to...@gmail.com> wrote:
>> I have one more question. Let's assume that I deployed some artifact.
>> Some people have used it so they have copy of it in local repository.
>> Now I change something in artifact and deploy it with the same version
>> number. Will all the people which have a copy of previous version in
>> local repository still use old version, or maybe maven will see that
>> there is a new version of this library (with the same version number
>> as previous) and automatically download it from remote repository
>> during the building?
>
> You should use a version number ending in -SNAPSHOT, which tells Maven
> that it's under development. The default policy is to check for
> updates once a day, but you can force a check with -U on the command
> line.
>
> If you change a released (non-SNAPSHOT) version, anyone who has
> already downloaded it will not see the changes unless they delete it
> from their local repo. Releases are not supposed to be changed.
>
> --
> Wendy
>
> ---------------------------------------------------------------------
> 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: building two artifacts with shared source code
Posted by Wendy Smoak <ws...@gmail.com>.
On Wed, Sep 24, 2008 at 9:51 PM, Tomek Maciejewski
<to...@gmail.com> wrote:
> I have one more question. Let's assume that I deployed some artifact.
> Some people have used it so they have copy of it in local repository.
> Now I change something in artifact and deploy it with the same version
> number. Will all the people which have a copy of previous version in
> local repository still use old version, or maybe maven will see that
> there is a new version of this library (with the same version number
> as previous) and automatically download it from remote repository
> during the building?
You should use a version number ending in -SNAPSHOT, which tells Maven
that it's under development. The default policy is to check for
updates once a day, but you can force a check with -U on the command
line.
If you change a released (non-SNAPSHOT) version, anyone who has
already downloaded it will not see the changes unless they delete it
from their local repo. Releases are not supposed to be changed.
--
Wendy
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org