[Math] Compile only top-level package and below

classic Classic list List threaded Threaded
32 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[Math] Compile only top-level package and below

Gilles Sadowski
Hello.

There are two branches for Commons Math.

For one, the top-level Java package is
   org.apache.commons.math4
For the other, it is
   org.apache.commons.math3

Unless I'm mistaken, this should imply that maven tries to compile
only files under either
   src/main/java/org/apache/commons/math4
   src/test/java/org/apache/commons/math4
or
   src/main/java/org/apache/commons/math3
   src/test/java/org/apache/commons/math3

But it happens that I have currently files in "math3" not currently
checked in into git: those are new files which git does not remove
when switching branches.
Then when starting a compilation in "master" (where the top-level
is "math4"), lots of compilation errors occur.

The "source" top-level directories do not seem to be specified
in the project's POM.
Can the parent be changed in order to produce the desired behaviour?

Or is there a workaround?
Is there a better way to handle the situation (short of manually
moving the source files back and forth)?


Thanks,
Gilles


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

sebb-2-2
On 4 September 2015 at 14:08, Gilles <[hidden email]> wrote:

> Hello.
>
> There are two branches for Commons Math.
>
> For one, the top-level Java package is
>   org.apache.commons.math4
> For the other, it is
>   org.apache.commons.math3
>
> Unless I'm mistaken, this should imply that maven tries to compile
> only files under either
>   src/main/java/org/apache/commons/math4
>   src/test/java/org/apache/commons/math4
> or
>   src/main/java/org/apache/commons/math3
>   src/test/java/org/apache/commons/math3

No, Maven compiles everything under src/[main|test]/java by default.

You could change that to

src/main/java/org/apache/commons/math4

but then the compiler would complain about mismatched package names

> But it happens that I have currently files in "math3" not currently
> checked in into git: those are new files which git does not remove
> when switching branches.

That's the problem - spurious files in the workspace.

> Then when starting a compilation in "master" (where the top-level
> is "math4"), lots of compilation errors occur.
>
> The "source" top-level directories do not seem to be specified
> in the project's POM.

No, because Maven defaults to the standard directory layout.

> Can the parent be changed in order to produce the desired behaviour?

Well, you might be able to exclude all files under math3/math4 but it
will be tricky to do and non-standard.

> Or is there a workaround?

Remove the spurious files ...

> Is there a better way to handle the situation (short of manually
> moving the source files back and forth)?

Why not use two checkouts and switch between them instead of switching
the contents of a single checkout?

>
> Thanks,
> Gilles
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

Gilles Sadowski
Hi.

On Fri, 4 Sep 2015 15:30:57 +0100, sebb wrote:

> On 4 September 2015 at 14:08, Gilles <[hidden email]>
> wrote:
>> Hello.
>>
>> There are two branches for Commons Math.
>>
>> For one, the top-level Java package is
>>   org.apache.commons.math4
>> For the other, it is
>>   org.apache.commons.math3
>>
>> Unless I'm mistaken, this should imply that maven tries to compile
>> only files under either
>>   src/main/java/org/apache/commons/math4
>>   src/test/java/org/apache/commons/math4
>> or
>>   src/main/java/org/apache/commons/math3
>>   src/test/java/org/apache/commons/math3
>
> No, Maven compiles everything under src/[main|test]/java by default.
>
> You could change that to
>
> src/main/java/org/apache/commons/math4
>
> but then the compiler would complain about mismatched package names
>
>> But it happens that I have currently files in "math3" not currently
>> checked in into git: those are new files which git does not remove
>> when switching branches.
>
> That's the problem - spurious files in the workspace.
>
>> Then when starting a compilation in "master" (where the top-level
>> is "math4"), lots of compilation errors occur.
>>
>> The "source" top-level directories do not seem to be specified
>> in the project's POM.
>
> No, because Maven defaults to the standard directory layout.
>
>> Can the parent be changed in order to produce the desired behaviour?
>
> Well, you might be able to exclude all files under math3/math4 but it
> will be tricky to do and non-standard.

But it is standard: source files must belong to the "top-level" package
of the project.

We don't change the top of the package hierarchy, just filter out the
files that do not belong to the project (as per the policy).

>
>> Or is there a workaround?
>
> Remove the spurious files ...

They are not "spurious".
They just happen to end with ".java".

>> Is there a better way to handle the situation (short of manually
>> moving the source files back and forth)?
>
> Why not use two checkouts and switch between them instead of
> switching
> the contents of a single checkout?

I might have to resort to that.
But it does not look nice (IOW why having branches if not to switch
between
them?).


Thanks,
Gilles


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

ole ersoy
In reply to this post by sebb-2-2
You have left over files in `target` after switching between the branches.  For example check out `math4`.  Build it.  Switch to the `math3` branch.  Build it.  Now `target` will contain both classes from the math3 branch and the math4 branch.

Run clean before switching between branches and you should be OK.

Cheers,
- Ole


On 09/04/2015 09:30 AM, sebb wrote:

> On 4 September 2015 at 14:08, Gilles <[hidden email]> wrote:
>> Hello.
>>
>> There are two branches for Commons Math.
>>
>> For one, the top-level Java package is
>>    org.apache.commons.math4
>> For the other, it is
>>    org.apache.commons.math3
>>
>> Unless I'm mistaken, this should imply that maven tries to compile
>> only files under either
>>    src/main/java/org/apache/commons/math4
>>    src/test/java/org/apache/commons/math4
>> or
>>    src/main/java/org/apache/commons/math3
>>    src/test/java/org/apache/commons/math3
> No, Maven compiles everything under src/[main|test]/java by default.
>
> You could change that to
>
> src/main/java/org/apache/commons/math4
>
> but then the compiler would complain about mismatched package names
>
>> But it happens that I have currently files in "math3" not currently
>> checked in into git: those are new files which git does not remove
>> when switching branches.
> That's the problem - spurious files in the workspace.
>
>> Then when starting a compilation in "master" (where the top-level
>> is "math4"), lots of compilation errors occur.
>>
>> The "source" top-level directories do not seem to be specified
>> in the project's POM.
> No, because Maven defaults to the standard directory layout.
>
>> Can the parent be changed in order to produce the desired behaviour?
> Well, you might be able to exclude all files under math3/math4 but it
> will be tricky to do and non-standard.
>
>> Or is there a workaround?
> Remove the spurious files ...
>
>> Is there a better way to handle the situation (short of manually
>> moving the source files back and forth)?
> Why not use two checkouts and switch between them instead of switching
> the contents of a single checkout?
>
>> Thanks,
>> Gilles
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

sebb-2-2
In reply to this post by Gilles Sadowski
On 4 September 2015 at 15:42, Gilles <[hidden email]> wrote:

> Hi.
>
>
> On Fri, 4 Sep 2015 15:30:57 +0100, sebb wrote:
>>
>> On 4 September 2015 at 14:08, Gilles <[hidden email]> wrote:
>>>
>>> Hello.
>>>
>>> There are two branches for Commons Math.
>>>
>>> For one, the top-level Java package is
>>>   org.apache.commons.math4
>>> For the other, it is
>>>   org.apache.commons.math3
>>>
>>> Unless I'm mistaken, this should imply that maven tries to compile
>>> only files under either
>>>   src/main/java/org/apache/commons/math4
>>>   src/test/java/org/apache/commons/math4
>>> or
>>>   src/main/java/org/apache/commons/math3
>>>   src/test/java/org/apache/commons/math3
>>
>>
>> No, Maven compiles everything under src/[main|test]/java by default.
>>
>> You could change that to
>>
>> src/main/java/org/apache/commons/math4
>>
>> but then the compiler would complain about mismatched package names
>>
>>> But it happens that I have currently files in "math3" not currently
>>> checked in into git: those are new files which git does not remove
>>> when switching branches.
>>
>>
>> That's the problem - spurious files in the workspace.
>>
>>> Then when starting a compilation in "master" (where the top-level
>>> is "math4"), lots of compilation errors occur.
>>>
>>> The "source" top-level directories do not seem to be specified
>>> in the project's POM.
>>
>>
>> No, because Maven defaults to the standard directory layout.
>>
>>> Can the parent be changed in order to produce the desired behaviour?
>>
>>
>> Well, you might be able to exclude all files under math3/math4 but it
>> will be tricky to do and non-standard.
>
>
> But it is standard: source files must belong to the "top-level" package
> of the project.

No, that's not always the case.
Some components have examples etc that are in a different package entirely.

> We don't change the top of the package hierarchy, just filter out the
> files that do not belong to the project (as per the policy).

What policy?

Note that although the the Maven coordinates must change when
top-level package names change there is no requirement for them to use
the same naming convention.
In fact they don't - the group id is commons-math3, not math3

>>
>>> Or is there a workaround?
>>
>>
>> Remove the spurious files ...
>
>
> They are not "spurious".
> They just happen to end with ".java".

Yes, they are spurious because they don't belong in the workspace.

It's not just java files that may cause problems.
Unless the build workspace is "clean", various issues may occur.

>>> Is there a better way to handle the situation (short of manually
>>> moving the source files back and forth)?
>>
>>
>> Why not use two checkouts and switch between them instead of switching
>> the contents of a single checkout?
>
>
> I might have to resort to that.
> But it does not look nice (IOW why having branches if not to switch between
> them?).
>
>
> Thanks,
> Gilles
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

Gilles Sadowski
In reply to this post by ole ersoy
On Fri, 4 Sep 2015 10:11:04 -0500, Ole Ersoy wrote:
> You have left over files in `target` after switching between the
> branches.  For example check out `math4`.  Build it.  Switch to the
> `math3` branch.  Build it.  Now `target` will contain both classes
> from the math3 branch and the math4 branch.

No it's not the problem.
They are _source_ files.

>
> Run clean before switching between branches and you should be OK.

If they would be removed, that would not be OK! ;-)

Gilles

>
> Cheers,
> - Ole
>
>
> On 09/04/2015 09:30 AM, sebb wrote:
>> On 4 September 2015 at 14:08, Gilles <[hidden email]>
>> wrote:
>>> Hello.
>>>
>>> There are two branches for Commons Math.
>>>
>>> For one, the top-level Java package is
>>>    org.apache.commons.math4
>>> For the other, it is
>>>    org.apache.commons.math3
>>>
>>> Unless I'm mistaken, this should imply that maven tries to compile
>>> only files under either
>>>    src/main/java/org/apache/commons/math4
>>>    src/test/java/org/apache/commons/math4
>>> or
>>>    src/main/java/org/apache/commons/math3
>>>    src/test/java/org/apache/commons/math3
>> No, Maven compiles everything under src/[main|test]/java by default.
>>
>> You could change that to
>>
>> src/main/java/org/apache/commons/math4
>>
>> but then the compiler would complain about mismatched package names
>>
>>> But it happens that I have currently files in "math3" not currently
>>> checked in into git: those are new files which git does not remove
>>> when switching branches.
>> That's the problem - spurious files in the workspace.
>>
>>> Then when starting a compilation in "master" (where the top-level
>>> is "math4"), lots of compilation errors occur.
>>>
>>> The "source" top-level directories do not seem to be specified
>>> in the project's POM.
>> No, because Maven defaults to the standard directory layout.
>>
>>> Can the parent be changed in order to produce the desired
>>> behaviour?
>> Well, you might be able to exclude all files under math3/math4 but
>> it
>> will be tricky to do and non-standard.
>>
>>> Or is there a workaround?
>> Remove the spurious files ...
>>
>>> Is there a better way to handle the situation (short of manually
>>> moving the source files back and forth)?
>> Why not use two checkouts and switch between them instead of
>> switching
>> the contents of a single checkout?
>>
>>> Thanks,
>>> Gilles
>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

Gilles Sadowski
In reply to this post by sebb-2-2
On Fri, 4 Sep 2015 16:26:16 +0100, sebb wrote:

> On 4 September 2015 at 15:42, Gilles <[hidden email]>
> wrote:
>> Hi.
>>
>>
>> On Fri, 4 Sep 2015 15:30:57 +0100, sebb wrote:
>>>
>>> On 4 September 2015 at 14:08, Gilles <[hidden email]>
>>> wrote:
>>>>
>>>> Hello.
>>>>
>>>> There are two branches for Commons Math.
>>>>
>>>> For one, the top-level Java package is
>>>>   org.apache.commons.math4
>>>> For the other, it is
>>>>   org.apache.commons.math3
>>>>
>>>> Unless I'm mistaken, this should imply that maven tries to compile
>>>> only files under either
>>>>   src/main/java/org/apache/commons/math4
>>>>   src/test/java/org/apache/commons/math4
>>>> or
>>>>   src/main/java/org/apache/commons/math3
>>>>   src/test/java/org/apache/commons/math3
>>>
>>>
>>> No, Maven compiles everything under src/[main|test]/java by
>>> default.
>>>
>>> You could change that to
>>>
>>> src/main/java/org/apache/commons/math4
>>>
>>> but then the compiler would complain about mismatched package names
>>>
>>>> But it happens that I have currently files in "math3" not
>>>> currently
>>>> checked in into git: those are new files which git does not remove
>>>> when switching branches.
>>>
>>>
>>> That's the problem - spurious files in the workspace.
>>>
>>>> Then when starting a compilation in "master" (where the top-level
>>>> is "math4"), lots of compilation errors occur.
>>>>
>>>> The "source" top-level directories do not seem to be specified
>>>> in the project's POM.
>>>
>>>
>>> No, because Maven defaults to the standard directory layout.
>>>
>>>> Can the parent be changed in order to produce the desired
>>>> behaviour?
>>>
>>>
>>> Well, you might be able to exclude all files under math3/math4 but
>>> it
>>> will be tricky to do and non-standard.
>>
>>
>> But it is standard: source files must belong to the "top-level"
>> package
>> of the project.
>
> No, that's not always the case.
> Some components have examples etc that are in a different package
> entirely.
>
>> We don't change the top of the package hierarchy, just filter out
>> the
>> files that do not belong to the project (as per the policy).
>
> What policy?

Do you that it's OK to have an Apache project publish files that are
not
under the project's top-level package?

> Note that although the the Maven coordinates must change when
> top-level package names change there is no requirement for them to
> use
> the same naming convention.
> In fact they don't - the group id is commons-math3, not math3
>
>>>
>>>> Or is there a workaround?
>>>
>>>
>>> Remove the spurious files ...
>>
>>
>> They are not "spurious".
>> They just happen to end with ".java".
>
> Yes, they are spurious because they don't belong in the workspace.
>
> It's not just java files that may cause problems.
> Unless the build workspace is "clean", various issues may occur.

I just want that maven does not to compile things under a "math3"
when the project is "math4" (and vice-versa).

That seems pretty reasonable.

Gilles


>>>> Is there a better way to handle the situation (short of manually
>>>> moving the source files back and forth)?
>>>
>>>
>>> Why not use two checkouts and switch between them instead of
>>> switching
>>> the contents of a single checkout?
>>
>>
>> I might have to resort to that.
>> But it does not look nice (IOW why having branches if not to switch
>> between
>> them?).
>>
>>
>> Thanks,
>> Gilles



---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

ole ersoy
In reply to this post by Gilles Sadowski


On 09/04/2015 10:26 AM, Gilles wrote:
> On Fri, 4 Sep 2015 10:11:04 -0500, Ole Ersoy wrote:
>> You have left over files in `target` after switching between the
>> branches.  For example check out `math4`.  Build it.  Switch to the
>> `math3` branch.  Build it.  Now `target` will contain both classes
>> from the math3 branch and the math4 branch.
>
> No it's not the problem.
> They are _source_ files.
Ahh - OK - Not sure if this will help, but you can for example exclude the math3 package files from compilation like this:

|<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.0.2</version><configuration><source>1.6</source><target>1.6</target><includes><include>org/apace/commons/math4/*.java</include> </includes> </configuration> </plugin> </plugins>|

Cheers,
- Ole

>
>>
>> Run clean before switching between branches and you should be OK.
>
> If they would be removed, that would not be OK! ;-)
>
> Gilles
>
>>
>> Cheers,
>> - Ole
>>
>>
>> On 09/04/2015 09:30 AM, sebb wrote:
>>> On 4 September 2015 at 14:08, Gilles <[hidden email]> wrote:
>>>> Hello.
>>>>
>>>> There are two branches for Commons Math.
>>>>
>>>> For one, the top-level Java package is
>>>>    org.apache.commons.math4
>>>> For the other, it is
>>>>    org.apache.commons.math3
>>>>
>>>> Unless I'm mistaken, this should imply that maven tries to compile
>>>> only files under either
>>>>    src/main/java/org/apache/commons/math4
>>>>    src/test/java/org/apache/commons/math4
>>>> or
>>>>    src/main/java/org/apache/commons/math3
>>>>    src/test/java/org/apache/commons/math3
>>> No, Maven compiles everything under src/[main|test]/java by default.
>>>
>>> You could change that to
>>>
>>> src/main/java/org/apache/commons/math4
>>>
>>> but then the compiler would complain about mismatched package names
>>>
>>>> But it happens that I have currently files in "math3" not currently
>>>> checked in into git: those are new files which git does not remove
>>>> when switching branches.
>>> That's the problem - spurious files in the workspace.
>>>
>>>> Then when starting a compilation in "master" (where the top-level
>>>> is "math4"), lots of compilation errors occur.
>>>>
>>>> The "source" top-level directories do not seem to be specified
>>>> in the project's POM.
>>> No, because Maven defaults to the standard directory layout.
>>>
>>>> Can the parent be changed in order to produce the desired behaviour?
>>> Well, you might be able to exclude all files under math3/math4 but it
>>> will be tricky to do and non-standard.
>>>
>>>> Or is there a workaround?
>>> Remove the spurious files ...
>>>
>>>> Is there a better way to handle the situation (short of manually
>>>> moving the source files back and forth)?
>>> Why not use two checkouts and switch between them instead of switching
>>> the contents of a single checkout?
>>>
>>>> Thanks,
>>>> Gilles
>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: [hidden email]
>>>> For additional commands, e-mail: [hidden email]
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: [hidden email]
>>> For additional commands, e-mail: [hidden email]
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [hidden email]
>> For additional commands, e-mail: [hidden email]
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
> .
>

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

Luc Maisonobe-2
In reply to this post by Gilles Sadowski
Hi Gilles,

Le 04/09/2015 17:30, Gilles a écrit :

> On Fri, 4 Sep 2015 16:26:16 +0100, sebb wrote:
>> On 4 September 2015 at 15:42, Gilles <[hidden email]>
>> wrote:
>>> Hi.
>>>
>>>
>>> On Fri, 4 Sep 2015 15:30:57 +0100, sebb wrote:
>>>>
>>>> On 4 September 2015 at 14:08, Gilles <[hidden email]>
>>>> wrote:
>>>>>
>>>>> Hello.
>>>>>
>>>>> There are two branches for Commons Math.
>>>>>
>>>>> For one, the top-level Java package is
>>>>>   org.apache.commons.math4
>>>>> For the other, it is
>>>>>   org.apache.commons.math3
>>>>>
>>>>> Unless I'm mistaken, this should imply that maven tries to compile
>>>>> only files under either
>>>>>   src/main/java/org/apache/commons/math4
>>>>>   src/test/java/org/apache/commons/math4
>>>>> or
>>>>>   src/main/java/org/apache/commons/math3
>>>>>   src/test/java/org/apache/commons/math3
>>>>
>>>>
>>>> No, Maven compiles everything under src/[main|test]/java by default.
>>>>
>>>> You could change that to
>>>>
>>>> src/main/java/org/apache/commons/math4
>>>>
>>>> but then the compiler would complain about mismatched package names
>>>>
>>>>> But it happens that I have currently files in "math3" not currently
>>>>> checked in into git: those are new files which git does not remove
>>>>> when switching branches.
>>>>
>>>>
>>>> That's the problem - spurious files in the workspace.
>>>>
>>>>> Then when starting a compilation in "master" (where the top-level
>>>>> is "math4"), lots of compilation errors occur.
>>>>>
>>>>> The "source" top-level directories do not seem to be specified
>>>>> in the project's POM.
>>>>
>>>>
>>>> No, because Maven defaults to the standard directory layout.
>>>>
>>>>> Can the parent be changed in order to produce the desired behaviour?
>>>>
>>>>
>>>> Well, you might be able to exclude all files under math3/math4 but it
>>>> will be tricky to do and non-standard.
>>>
>>>
>>> But it is standard: source files must belong to the "top-level" package
>>> of the project.
>>
>> No, that's not always the case.
>> Some components have examples etc that are in a different package
>> entirely.
>>
>>> We don't change the top of the package hierarchy, just filter out the
>>> files that do not belong to the project (as per the policy).
>>
>> What policy?
>
> Do you that it's OK to have an Apache project publish files that are not
> under the project's top-level package?

No, hence there should not be source files that do not belong to the
top level package in the source folder.

The fact is maven is used in many different situations, not only in
Apache Commons. In order to streamline everything, the maven project
has decided to stick with "conventions over configuration", which
means one should really obey the conventions. This explains why it
is so difficult to do otherwise. If you attempt to not follow the
maven imposed conventions, you are going to suffer a lot fighting
agains maven ... and at the end maven wins as you throw in the towel.

So the convention imposed by maven is really to compile everything
under src/main/language-name and src/test/language-name. It does not
care about the top-level package and I don't even think it has a
notion of top-level package (though many plugins may be aware of
packages names).

What I don't get is why you need these files to be precisely at
this place while not compiling them. If you don't want to compile
them and typically use them only as reference couldn't these files
be only a few folders away? Then, you could have two development
trees, one for math3 and one for math4, always available together
but not mixed in a single folder. As even the pom file is above
src/, with separate folders you could even have both pom files
available if you need to do some comparisons or parallel compilations
and tests runs.

best regards,
Luc

>
>> Note that although the the Maven coordinates must change when
>> top-level package names change there is no requirement for them to use
>> the same naming convention.
>> In fact they don't - the group id is commons-math3, not math3
>>
>>>>
>>>>> Or is there a workaround?
>>>>
>>>>
>>>> Remove the spurious files ...
>>>
>>>
>>> They are not "spurious".
>>> They just happen to end with ".java".
>>
>> Yes, they are spurious because they don't belong in the workspace.
>>
>> It's not just java files that may cause problems.
>> Unless the build workspace is "clean", various issues may occur.
>
> I just want that maven does not to compile things under a "math3"
> when the project is "math4" (and vice-versa).
>
> That seems pretty reasonable.
>
> Gilles
>
>
>>>>> Is there a better way to handle the situation (short of manually
>>>>> moving the source files back and forth)?
>>>>
>>>>
>>>> Why not use two checkouts and switch between them instead of switching
>>>> the contents of a single checkout?
>>>
>>>
>>> I might have to resort to that.
>>> But it does not look nice (IOW why having branches if not to switch
>>> between
>>> them?).
>>>
>>>
>>> Thanks,
>>> Gilles
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

sebb-2-2
In reply to this post by Gilles Sadowski
On 4 September 2015 at 16:30, Gilles <[hidden email]> wrote:

> On Fri, 4 Sep 2015 16:26:16 +0100, sebb wrote:
>>
>> On 4 September 2015 at 15:42, Gilles <[hidden email]> wrote:
>>>
>>> Hi.
>>>
>>>
>>> On Fri, 4 Sep 2015 15:30:57 +0100, sebb wrote:
>>>>
>>>>
>>>> On 4 September 2015 at 14:08, Gilles <[hidden email]>
>>>> wrote:
>>>>>
>>>>>
>>>>> Hello.
>>>>>
>>>>> There are two branches for Commons Math.
>>>>>
>>>>> For one, the top-level Java package is
>>>>>   org.apache.commons.math4
>>>>> For the other, it is
>>>>>   org.apache.commons.math3
>>>>>
>>>>> Unless I'm mistaken, this should imply that maven tries to compile
>>>>> only files under either
>>>>>   src/main/java/org/apache/commons/math4
>>>>>   src/test/java/org/apache/commons/math4
>>>>> or
>>>>>   src/main/java/org/apache/commons/math3
>>>>>   src/test/java/org/apache/commons/math3
>>>>
>>>>
>>>>
>>>> No, Maven compiles everything under src/[main|test]/java by default.
>>>>
>>>> You could change that to
>>>>
>>>> src/main/java/org/apache/commons/math4
>>>>
>>>> but then the compiler would complain about mismatched package names
>>>>
>>>>> But it happens that I have currently files in "math3" not currently
>>>>> checked in into git: those are new files which git does not remove
>>>>> when switching branches.
>>>>
>>>>
>>>>
>>>> That's the problem - spurious files in the workspace.
>>>>
>>>>> Then when starting a compilation in "master" (where the top-level
>>>>> is "math4"), lots of compilation errors occur.
>>>>>
>>>>> The "source" top-level directories do not seem to be specified
>>>>> in the project's POM.
>>>>
>>>>
>>>>
>>>> No, because Maven defaults to the standard directory layout.
>>>>
>>>>> Can the parent be changed in order to produce the desired behaviour?
>>>>
>>>>
>>>>
>>>> Well, you might be able to exclude all files under math3/math4 but it
>>>> will be tricky to do and non-standard.
>>>
>>>
>>>
>>> But it is standard: source files must belong to the "top-level" package
>>> of the project.
>>
>>
>> No, that's not always the case.
>> Some components have examples etc that are in a different package
>> entirely.
>>
>>> We don't change the top of the package hierarchy, just filter out the
>>> files that do not belong to the project (as per the policy).
>>
>>
>> What policy?
>
>
> Do you that it's OK to have an Apache project publish files that are not
> under the project's top-level package?

Yes, if they are example files that are not part of the component.

>> Note that although the the Maven coordinates must change when
>> top-level package names change there is no requirement for them to use
>> the same naming convention.
>> In fact they don't - the group id is commons-math3, not math3
>>
>>>>
>>>>> Or is there a workaround?
>>>>
>>>>
>>>>
>>>> Remove the spurious files ...
>>>
>>>
>>>
>>> They are not "spurious".
>>> They just happen to end with ".java".
>>
>>
>> Yes, they are spurious because they don't belong in the workspace.
>>
>> It's not just java files that may cause problems.
>> Unless the build workspace is "clean", various issues may occur.
>
>
> I just want that maven does not to compile things under a "math3"
> when the project is "math4" (and vice-versa).
>
> That seems pretty reasonable.

So should Ant behave the same?
And Gradle
Etc?

I think it would be very confusing if Maven failed to build source
files that happened to be in the wrong part of the source tree.

> Gilles
>
>
>
>>>>> Is there a better way to handle the situation (short of manually
>>>>> moving the source files back and forth)?
>>>>
>>>>
>>>>
>>>> Why not use two checkouts and switch between them instead of switching
>>>> the contents of a single checkout?
>>>
>>>
>>>
>>> I might have to resort to that.
>>> But it does not look nice (IOW why having branches if not to switch
>>> between
>>> them?).
>>>
>>>
>>> Thanks,
>>> Gilles
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

Thomas Neidhart
In reply to this post by Gilles Sadowski
On 09/04/2015 03:08 PM, Gilles wrote:

> Hello.
>
> There are two branches for Commons Math.
>
> For one, the top-level Java package is
>   org.apache.commons.math4
> For the other, it is
>   org.apache.commons.math3
>
> Unless I'm mistaken, this should imply that maven tries to compile
> only files under either
>   src/main/java/org/apache/commons/math4
>   src/test/java/org/apache/commons/math4
> or
>   src/main/java/org/apache/commons/math3
>   src/test/java/org/apache/commons/math3
>
> But it happens that I have currently files in "math3" not currently
> checked in into git: those are new files which git does not remove
> when switching branches.
> Then when starting a compilation in "master" (where the top-level
> is "math4"), lots of compilation errors occur.
>
> The "source" top-level directories do not seem to be specified
> in the project's POM.
> Can the parent be changed in order to produce the desired behaviour?
>
> Or is there a workaround?
> Is there a better way to handle the situation (short of manually
> moving the source files back and forth)?

you probably want to take a loot at the stash command from git.

This is very helpful (and needed) when switching between branches.
The source files are required to be tracked by git though (i.e. need to
be added).

afaik, you can also exclude files from the src folder, so that they are
not compiled.

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

Gilles Sadowski
In reply to this post by ole ersoy
On Fri, 4 Sep 2015 11:03:08 -0500, Ole Ersoy wrote:

> On 09/04/2015 10:26 AM, Gilles wrote:
>> On Fri, 4 Sep 2015 10:11:04 -0500, Ole Ersoy wrote:
>>> You have left over files in `target` after switching between the
>>> branches.  For example check out `math4`.  Build it.  Switch to the
>>> `math3` branch.  Build it.  Now `target` will contain both classes
>>> from the math3 branch and the math4 branch.
>>
>> No it's not the problem.
>> They are _source_ files.
> Ahh - OK - Not sure if this will help, but you can for example
> exclude the math3 package files from compilation like this:
>
>
> |<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.0.2</version><configuration><source>1.6</source><target>1.6</target><includes><include>org/apace/commons/math4/*.java</include>
> </includes> </configuration> </plugin> </plugins>|
>

That works fine!

Thus it's not that maven _has_ to compile everything under "src/main";
it can be told otherwise.
Perhaps there are nasty side effects to that selection (?).
Otherwise, I still don't understand why it cannot be included in the
POM file...

Thanks,
Gilles


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

Gilles Sadowski
In reply to this post by Luc Maisonobe-2
On Fri, 04 Sep 2015 18:19:42 +0200, Luc Maisonobe wrote:

> Hi Gilles,
>
> Le 04/09/2015 17:30, Gilles a écrit :
>> On Fri, 4 Sep 2015 16:26:16 +0100, sebb wrote:
>>> On 4 September 2015 at 15:42, Gilles <[hidden email]>
>>> wrote:
>>>> Hi.
>>>>
>>>>
>>>> On Fri, 4 Sep 2015 15:30:57 +0100, sebb wrote:
>>>>>
>>>>> On 4 September 2015 at 14:08, Gilles
>>>>> <[hidden email]>
>>>>> wrote:
>>>>>>
>>>>>> Hello.
>>>>>>
>>>>>> There are two branches for Commons Math.
>>>>>>
>>>>>> For one, the top-level Java package is
>>>>>>   org.apache.commons.math4
>>>>>> For the other, it is
>>>>>>   org.apache.commons.math3
>>>>>>
>>>>>> Unless I'm mistaken, this should imply that maven tries to
>>>>>> compile
>>>>>> only files under either
>>>>>>   src/main/java/org/apache/commons/math4
>>>>>>   src/test/java/org/apache/commons/math4
>>>>>> or
>>>>>>   src/main/java/org/apache/commons/math3
>>>>>>   src/test/java/org/apache/commons/math3
>>>>>
>>>>>
>>>>> No, Maven compiles everything under src/[main|test]/java by
>>>>> default.
>>>>>
>>>>> You could change that to
>>>>>
>>>>> src/main/java/org/apache/commons/math4
>>>>>
>>>>> but then the compiler would complain about mismatched package
>>>>> names
>>>>>
>>>>>> But it happens that I have currently files in "math3" not
>>>>>> currently
>>>>>> checked in into git: those are new files which git does not
>>>>>> remove
>>>>>> when switching branches.
>>>>>
>>>>>
>>>>> That's the problem - spurious files in the workspace.
>>>>>
>>>>>> Then when starting a compilation in "master" (where the
>>>>>> top-level
>>>>>> is "math4"), lots of compilation errors occur.
>>>>>>
>>>>>> The "source" top-level directories do not seem to be specified
>>>>>> in the project's POM.
>>>>>
>>>>>
>>>>> No, because Maven defaults to the standard directory layout.
>>>>>
>>>>>> Can the parent be changed in order to produce the desired
>>>>>> behaviour?
>>>>>
>>>>>
>>>>> Well, you might be able to exclude all files under math3/math4
>>>>> but it
>>>>> will be tricky to do and non-standard.
>>>>
>>>>
>>>> But it is standard: source files must belong to the "top-level"
>>>> package
>>>> of the project.
>>>
>>> No, that's not always the case.
>>> Some components have examples etc that are in a different package
>>> entirely.
>>>
>>>> We don't change the top of the package hierarchy, just filter out
>>>> the
>>>> files that do not belong to the project (as per the policy).
>>>
>>> What policy?
>>
>> Do you that it's OK to have an Apache project publish files that are
>> not
>> under the project's top-level package?
>
> No, hence there should not be source files that do not belong to the
> top level package in the source folder.
>
> The fact is maven is used in many different situations, not only in
> Apache Commons. In order to streamline everything, the maven project
> has decided to stick with "conventions over configuration", which
> means one should really obey the conventions. This explains why it
> is so difficult to do otherwise. If you attempt to not follow the
> maven imposed conventions, you are going to suffer a lot fighting
> agains maven ... and at the end maven wins as you throw in the towel.
>
> So the convention imposed by maven is really to compile everything
> under src/main/language-name and src/test/language-name. It does not
> care about the top-level package and I don't even think it has a
> notion of top-level package (though many plugins may be aware of
> packages names).

But it can told to compile only specific files (cf. Ole's suggestion).

> What I don't get is why you need these files to be precisely at
> this place while not compiling them. If you don't want to compile
> them and typically use them only as reference couldn't these files
> be only a few folders away? Then, you could have two development
> trees, one for math3 and one for math4, always available together
> but not mixed in a single folder. As even the pom file is above
> src/, with separate folders you could even have both pom files
> available if you need to do some comparisons or parallel compilations
> and tests runs.

Well, I started to use git branching which suggests that one should
download the various branches onto the same repository and switch
between
them.
Then I happened to want to create a few files (for testing a potential
new feature before proposing it for inclusion). [And I do want to have
them compiled; just not within the "wrong" project!]
I'm not so happy having to repeatedly "stash" just to be able to switch
to
the other branch for  almost trivial copy/paste (of backported code).  
It
looked more interesting to delay the "git add"...

So it seems that the alternatives are:
1. Have separate repositories for each branch
2. Modify the POM
3. "git add" new source files and stash, stash, stash

 From the discussion here, none seems particularly appealing.

Best,
Gilles

>
> best regards,
> Luc
>
>> [...]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

Gilles Sadowski
In reply to this post by sebb-2-2
On Fri, 4 Sep 2015 18:30:45 +0100, sebb wrote:

> On 4 September 2015 at 16:30, Gilles <[hidden email]>
> wrote:
>> On Fri, 4 Sep 2015 16:26:16 +0100, sebb wrote:
>>>
>>> On 4 September 2015 at 15:42, Gilles <[hidden email]>
>>> wrote:
>>>>
>>>> Hi.
>>>>
>>>>
>>>> On Fri, 4 Sep 2015 15:30:57 +0100, sebb wrote:
>>>>>
>>>>>
>>>>> On 4 September 2015 at 14:08, Gilles
>>>>> <[hidden email]>
>>>>> wrote:
>>>>>>
>>>>>>
>>>>>> Hello.
>>>>>>
>>>>>> There are two branches for Commons Math.
>>>>>>
>>>>>> For one, the top-level Java package is
>>>>>>   org.apache.commons.math4
>>>>>> For the other, it is
>>>>>>   org.apache.commons.math3
>>>>>>
>>>>>> Unless I'm mistaken, this should imply that maven tries to
>>>>>> compile
>>>>>> only files under either
>>>>>>   src/main/java/org/apache/commons/math4
>>>>>>   src/test/java/org/apache/commons/math4
>>>>>> or
>>>>>>   src/main/java/org/apache/commons/math3
>>>>>>   src/test/java/org/apache/commons/math3
>>>>>
>>>>>
>>>>>
>>>>> No, Maven compiles everything under src/[main|test]/java by
>>>>> default.
>>>>>
>>>>> You could change that to
>>>>>
>>>>> src/main/java/org/apache/commons/math4
>>>>>
>>>>> but then the compiler would complain about mismatched package
>>>>> names
>>>>>
>>>>>> But it happens that I have currently files in "math3" not
>>>>>> currently
>>>>>> checked in into git: those are new files which git does not
>>>>>> remove
>>>>>> when switching branches.
>>>>>
>>>>>
>>>>>
>>>>> That's the problem - spurious files in the workspace.
>>>>>
>>>>>> Then when starting a compilation in "master" (where the
>>>>>> top-level
>>>>>> is "math4"), lots of compilation errors occur.
>>>>>>
>>>>>> The "source" top-level directories do not seem to be specified
>>>>>> in the project's POM.
>>>>>
>>>>>
>>>>>
>>>>> No, because Maven defaults to the standard directory layout.
>>>>>
>>>>>> Can the parent be changed in order to produce the desired
>>>>>> behaviour?
>>>>>
>>>>>
>>>>>
>>>>> Well, you might be able to exclude all files under math3/math4
>>>>> but it
>>>>> will be tricky to do and non-standard.
>>>>
>>>>
>>>>
>>>> But it is standard: source files must belong to the "top-level"
>>>> package
>>>> of the project.
>>>
>>>
>>> No, that's not always the case.
>>> Some components have examples etc that are in a different package
>>> entirely.
>>>
>>>> We don't change the top of the package hierarchy, just filter out
>>>> the
>>>> files that do not belong to the project (as per the policy).
>>>
>>>
>>> What policy?
>>
>>
>> Do you that it's OK to have an Apache project publish files that are
>> not
>> under the project's top-level package?
>
> Yes, if they are example files that are not part of the component.
>
>>> Note that although the the Maven coordinates must change when
>>> top-level package names change there is no requirement for them to
>>> use
>>> the same naming convention.
>>> In fact they don't - the group id is commons-math3, not math3
>>>
>>>>>
>>>>>> Or is there a workaround?
>>>>>
>>>>>
>>>>>
>>>>> Remove the spurious files ...
>>>>
>>>>
>>>>
>>>> They are not "spurious".
>>>> They just happen to end with ".java".
>>>
>>>
>>> Yes, they are spurious because they don't belong in the workspace.
>>>
>>> It's not just java files that may cause problems.
>>> Unless the build workspace is "clean", various issues may occur.
>>
>>
>> I just want that maven does not to compile things under a "math3"
>> when the project is "math4" (and vice-versa).
>>
>> That seems pretty reasonable.
>
> So should Ant behave the same?
> And Gradle
> Etc?

I don't think I implied that the tool(s) should be changed, just
that they might be configured such that they would not try to
compile "spurious" files.
That *is* possible, as per Ole's suggestion.
Are there any drawbacks to enforce that policy (at least for CM where
there are no legitimate files above the projects top-level directory)?

> I think it would be very confusing if Maven failed to build source
> files that happened to be in the wrong part of the source tree.

I don't understand.
My problem is precisely that those files cannot be compiled, because
their dependencies have been hidden away by "git" (files that belong
to the "math3" branch "disappear" when switching to the "math4"
branch).  New files, not yet managed by "git", stay there (and cannot
be compiled).

Gilles

>> [...]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

Gilles Sadowski
In reply to this post by Thomas Neidhart
On Fri, 04 Sep 2015 19:50:05 +0200, Thomas Neidhart wrote:

> On 09/04/2015 03:08 PM, Gilles wrote:
>> Hello.
>>
>> There are two branches for Commons Math.
>>
>> For one, the top-level Java package is
>>   org.apache.commons.math4
>> For the other, it is
>>   org.apache.commons.math3
>>
>> Unless I'm mistaken, this should imply that maven tries to compile
>> only files under either
>>   src/main/java/org/apache/commons/math4
>>   src/test/java/org/apache/commons/math4
>> or
>>   src/main/java/org/apache/commons/math3
>>   src/test/java/org/apache/commons/math3
>>
>> But it happens that I have currently files in "math3" not currently
>> checked in into git: those are new files which git does not remove
>> when switching branches.
>> Then when starting a compilation in "master" (where the top-level
>> is "math4"), lots of compilation errors occur.
>>
>> The "source" top-level directories do not seem to be specified
>> in the project's POM.
>> Can the parent be changed in order to produce the desired behaviour?
>>
>> Or is there a workaround?
>> Is there a better way to handle the situation (short of manually
>> moving the source files back and forth)?
>
> you probably want to take a loot at the stash command from git.
>
> This is very helpful (and needed) when switching between branches.
> The source files are required to be tracked by git though (i.e. need
> to
> be added).

Yes, I've used it, but perhaps not in the most efficient way (?).

For backporting, I ended up keeping files from "math4" open in an
editor.
Switch branch, and copy/paste code to the corresponding "math3" files.
:-}

Suggestion for a better way welcome (as requested a few weeks ago)...

>
> afaik, you can also exclude files from the src folder, so that they
> are
> not compiled.

That would be fine too (the "reverse" of Ole's proposal).


Gilles


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

ole ersoy
In reply to this post by Gilles Sadowski


On 09/04/2015 06:06 PM, Gilles wrote:

> On Fri, 4 Sep 2015 11:03:08 -0500, Ole Ersoy wrote:
>> On 09/04/2015 10:26 AM, Gilles wrote:
>>> On Fri, 4 Sep 2015 10:11:04 -0500, Ole Ersoy wrote:
>>>> You have left over files in `target` after switching between the
>>>> branches.  For example check out `math4`.  Build it.  Switch to the
>>>> `math3` branch.  Build it.  Now `target` will contain both classes
>>>> from the math3 branch and the math4 branch.
>>>
>>> No it's not the problem.
>>> They are _source_ files.
>> Ahh - OK - Not sure if this will help, but you can for example
>> exclude the math3 package files from compilation like this:
>>
>>
>> |<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.0.2</version><configuration><source>1.6</source><target>1.6</target><includes><include>org/apace/commons/math4/*.java</include>
>> </includes> </configuration> </plugin> </plugins>|
>>
>
> That works fine!
>
> Thus it's not that maven _has_ to compile everything under "src/main";
> it can be told otherwise.
> Perhaps there are nasty side effects to that selection (?).
If someone clones the master off of github in order to experiment and they are used to being able to compile everything under `src/main/java` then they may be in for a surprise.

>
> Otherwise, I still don't understand why it cannot be included in the
> POM file...

You could create two new branches that you have your own POM modifications in:

- math3-gilles
- math4-gilles

Cheers,
- Ole


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

sebb-2-2
On 5 September 2015 at 00:55, Ole Ersoy <[hidden email]> wrote:

>
>
> On 09/04/2015 06:06 PM, Gilles wrote:
>>
>> On Fri, 4 Sep 2015 11:03:08 -0500, Ole Ersoy wrote:
>>>
>>> On 09/04/2015 10:26 AM, Gilles wrote:
>>>>
>>>> On Fri, 4 Sep 2015 10:11:04 -0500, Ole Ersoy wrote:
>>>>>
>>>>> You have left over files in `target` after switching between the
>>>>> branches.  For example check out `math4`.  Build it.  Switch to the
>>>>> `math3` branch.  Build it.  Now `target` will contain both classes
>>>>> from the math3 branch and the math4 branch.
>>>>
>>>>
>>>> No it's not the problem.
>>>> They are _source_ files.
>>>
>>> Ahh - OK - Not sure if this will help, but you can for example
>>> exclude the math3 package files from compilation like this:
>>>
>>>
>>>
>>> |<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.0.2</version><configuration><source>1.6</source><target>1.6</target><includes><include>org/apace/commons/math4/*.java</include>
>>> </includes> </configuration> </plugin> </plugins>|
>>>
>>
>> That works fine!
>>
>> Thus it's not that maven _has_ to compile everything under "src/main";
>> it can be told otherwise.
>> Perhaps there are nasty side effects to that selection (?).
>
> If someone clones the master off of github in order to experiment and they
> are used to being able to compile everything under `src/main/java` then they
> may be in for a surprise.
>
>>
>> Otherwise, I still don't understand why it cannot be included in the
>> POM file...
>
>
> You could create two new branches that you have your own POM modifications
> in:
>
> - math3-gilles
> - math4-gilles

+1 to that!

-1 to adding the changes to the main branches.

> Cheers,
> - Ole
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

Gilles Sadowski
On Sat, 5 Sep 2015 00:56:54 +0100, sebb wrote:

> On 5 September 2015 at 00:55, Ole Ersoy <[hidden email]> wrote:
>>
>>
>> On 09/04/2015 06:06 PM, Gilles wrote:
>>>
>>> On Fri, 4 Sep 2015 11:03:08 -0500, Ole Ersoy wrote:
>>>>
>>>> On 09/04/2015 10:26 AM, Gilles wrote:
>>>>>
>>>>> On Fri, 4 Sep 2015 10:11:04 -0500, Ole Ersoy wrote:
>>>>>>
>>>>>> You have left over files in `target` after switching between the
>>>>>> branches.  For example check out `math4`.  Build it.  Switch to
>>>>>> the
>>>>>> `math3` branch.  Build it.  Now `target` will contain both
>>>>>> classes
>>>>>> from the math3 branch and the math4 branch.
>>>>>
>>>>>
>>>>> No it's not the problem.
>>>>> They are _source_ files.
>>>>
>>>> Ahh - OK - Not sure if this will help, but you can for example
>>>> exclude the math3 package files from compilation like this:
>>>>
>>>>
>>>>
>>>>
>>>> |<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.0.2</version><configuration><source>1.6</source><target>1.6</target><includes><include>org/apace/commons/math4/*.java</include>
>>>> </includes> </configuration> </plugin> </plugins>|
>>>>
>>>
>>> That works fine!
>>>
>>> Thus it's not that maven _has_ to compile everything under
>>> "src/main";
>>> it can be told otherwise.
>>> Perhaps there are nasty side effects to that selection (?).
>>
>> If someone clones the master off of github in order to experiment
>> and they
>> are used to being able to compile everything under `src/main/java`
>> then they
>> may be in for a surprise.
>>
>>>
>>> Otherwise, I still don't understand why it cannot be included in
>>> the
>>> POM file...
>>
>>
>> You could create two new branches that you have your own POM
>> modifications
>> in:
>>
>> - math3-gilles
>> - math4-gilles

IIUC, that would exchange "stash" for "merge".
I fail to see the gain. :-{

>
> +1 to that!
>
> -1 to adding the changes to the main branches.

Hmm, the POM contains several CM-tailored instructions (include this,
exclude that), plus (IIRC) we don't ship source files that are not
below "o.a.c.math3".  Thus why not reflect that in the POM too?
[It's the reverse of an argument given by Luc: why keep source files
under the project's "src/main/java/org/apache/commons/math3" if it's
*not* going to be part of the official project?]

Gilles


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

sebb-2-2
On 5 September 2015 at 01:13, Gilles <[hidden email]> wrote:

> On Sat, 5 Sep 2015 00:56:54 +0100, sebb wrote:
>>
>> On 5 September 2015 at 00:55, Ole Ersoy <[hidden email]> wrote:
>>>
>>>
>>>
>>> On 09/04/2015 06:06 PM, Gilles wrote:
>>>>
>>>>
>>>> On Fri, 4 Sep 2015 11:03:08 -0500, Ole Ersoy wrote:
>>>>>
>>>>>
>>>>> On 09/04/2015 10:26 AM, Gilles wrote:
>>>>>>
>>>>>>
>>>>>> On Fri, 4 Sep 2015 10:11:04 -0500, Ole Ersoy wrote:
>>>>>>>
>>>>>>>
>>>>>>> You have left over files in `target` after switching between the
>>>>>>> branches.  For example check out `math4`.  Build it.  Switch to the
>>>>>>> `math3` branch.  Build it.  Now `target` will contain both classes
>>>>>>> from the math3 branch and the math4 branch.
>>>>>>
>>>>>>
>>>>>>
>>>>>> No it's not the problem.
>>>>>> They are _source_ files.
>>>>>
>>>>>
>>>>> Ahh - OK - Not sure if this will help, but you can for example
>>>>> exclude the math3 package files from compilation like this:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> |<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.0.2</version><configuration><source>1.6</source><target>1.6</target><includes><include>org/apace/commons/math4/*.java</include>
>>>>> </includes> </configuration> </plugin> </plugins>|
>>>>>
>>>>
>>>> That works fine!
>>>>
>>>> Thus it's not that maven _has_ to compile everything under "src/main";
>>>> it can be told otherwise.
>>>> Perhaps there are nasty side effects to that selection (?).
>>>
>>>
>>> If someone clones the master off of github in order to experiment and
>>> they
>>> are used to being able to compile everything under `src/main/java` then
>>> they
>>> may be in for a surprise.
>>>
>>>>
>>>> Otherwise, I still don't understand why it cannot be included in the
>>>> POM file...
>>>
>>>
>>>
>>> You could create two new branches that you have your own POM
>>> modifications
>>> in:
>>>
>>> - math3-gilles
>>> - math4-gilles
>
>
> IIUC, that would exchange "stash" for "merge".
> I fail to see the gain. :-{
>
>>
>> +1 to that!
>>
>> -1 to adding the changes to the main branches.
>
>
> Hmm, the POM contains several CM-tailored instructions (include this,
> exclude that), plus (IIRC) we don't ship source files that are not
> below "o.a.c.math3".  Thus why not reflect that in the POM too?

We should ship everything in the SCM tree apart from the DOAP.

> [It's the reverse of an argument given by Luc: why keep source files
> under the project's "src/main/java/org/apache/commons/math3" if it's
> *not* going to be part of the official project?]

Exactly; only files that are intended for release should be in the tree.

It should be possible to compare the tag with the exploded source
archive and the two should agree, apart from the DOAP (and the SCM
work files, if present)

> Gilles
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: [Math] Compile only top-level package and below

ole ersoy


On 09/04/2015 08:14 PM, sebb wrote:

> On 5 September 2015 at 01:13, Gilles <[hidden email]> wrote:
>> On Sat, 5 Sep 2015 00:56:54 +0100, sebb wrote:
>>> On 5 September 2015 at 00:55, Ole Ersoy <[hidden email]> wrote:
>>>>
>>>>
>>>> On 09/04/2015 06:06 PM, Gilles wrote:
>>>>>
>>>>> On Fri, 4 Sep 2015 11:03:08 -0500, Ole Ersoy wrote:
>>>>>>
>>>>>> On 09/04/2015 10:26 AM, Gilles wrote:
>>>>>>>
>>>>>>> On Fri, 4 Sep 2015 10:11:04 -0500, Ole Ersoy wrote:
>>>>>>>>
>>>>>>>> You have left over files in `target` after switching between the
>>>>>>>> branches.  For example check out `math4`.  Build it.  Switch to the
>>>>>>>> `math3` branch.  Build it.  Now `target` will contain both classes
>>>>>>>> from the math3 branch and the math4 branch.
>>>>>>>
>>>>>>>
>>>>>>> No it's not the problem.
>>>>>>> They are _source_ files.
>>>>>>
>>>>>> Ahh - OK - Not sure if this will help, but you can for example
>>>>>> exclude the math3 package files from compilation like this:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> |<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><version>2.0.2</version><configuration><source>1.6</source><target>1.6</target><includes><include>org/apace/commons/math4/*.java</include>
>>>>>> </includes> </configuration> </plugin> </plugins>|
>>>>>>
>>>>> That works fine!
>>>>>
>>>>> Thus it's not that maven _has_ to compile everything under "src/main";
>>>>> it can be told otherwise.
>>>>> Perhaps there are nasty side effects to that selection (?).
>>>>
>>>> If someone clones the master off of github in order to experiment and
>>>> they
>>>> are used to being able to compile everything under `src/main/java` then
>>>> they
>>>> may be in for a surprise.
>>>>
>>>>> Otherwise, I still don't understand why it cannot be included in the
>>>>> POM file...
>>>>
>>>>
>>>> You could create two new branches that you have your own POM
>>>> modifications
>>>> in:
>>>>
>>>> - math3-gilles
>>>> - math4-gilles
>>
>> IIUC, that would exchange "stash" for "merge".
>> I fail to see the gain. :-{
These would be 2 temporary branches for your local environment only.  Once the changes are made and merged back into the original branches, these can be thrown away.  IIUC you just want a temporary place to do experiments with regressions, etc.  Personally I just like to have a sandbox branch to experiment with changes in case I mess something up ... OK fine when I mess something up :).

Ole

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

12