You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Gilles <gi...@harfang.homelinux.org> on 2015/09/04 15:08:09 UTC

[Math] Compile only top-level package and below

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: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Yahoo! <Ho...@Yahoo.com.INVALID>.
> On Sep 4, 2015, at 18:55, Gilles <gi...@harfang.homelinux.org> wrote:
> 
>> On Fri, 4 Sep 2015 20:38:36 -0500, Ole Ersoy wrote:
>>> On 09/04/2015 08:14 PM, sebb wrote:
>>>> On 5 September 2015 at 01:13, Gilles <gi...@harfang.homelinux.org> wrote:
>>>>> On Sat, 5 Sep 2015 00:56:54 +0100, sebb wrote:
>>>>>> On 5 September 2015 at 00:55, Ole Ersoy <ol...@gmail.com> 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 :).
> 
> OK, I imagine that this is the right way: systematically create a branch
> even when I thinks that it's not going to be worth it. More often than not,
> it will be worth it in the end... (As in avoiding to disturb our Grand
> Master Maven).
> 
> Thanks for the nudge,
> Gilles

Yes. Git branches are almost cost-free, so  http://nvie.com/posts/a-successful-git-branching-model/ has become a common, if not standard, workflow for Git, and there are tools for making this workflow easy to follow.  I personally use interactive rebasing in my personal branches almost every day.  Other tools such as GitUp and Atlassian's SourceTree make useful but more advanced techniques mentioned in the above article (e.g., composing commits by selecting certain lines from what has changed relative to the most recent commit) easy.

Al

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

Posted by Gilles <gi...@harfang.homelinux.org>.
On Fri, 4 Sep 2015 20:38:36 -0500, Ole Ersoy wrote:
> On 09/04/2015 08:14 PM, sebb wrote:
>> On 5 September 2015 at 01:13, Gilles <gi...@harfang.homelinux.org> 
>> wrote:
>>> On Sat, 5 Sep 2015 00:56:54 +0100, sebb wrote:
>>>> On 5 September 2015 at 00:55, Ole Ersoy <ol...@gmail.com> 
>>>> 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 :).

OK, I imagine that this is the right way: systematically create a 
branch
even when I thinks that it's not going to be worth it. More often than 
not,
it will be worth it in the end... (As in avoiding to disturb our Grand
Master Maven).

Thanks for the nudge,
Gilles


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Ole Ersoy <ol...@gmail.com>.

On 09/04/2015 08:14 PM, sebb wrote:
> On 5 September 2015 at 01:13, Gilles <gi...@harfang.homelinux.org> wrote:
>> On Sat, 5 Sep 2015 00:56:54 +0100, sebb wrote:
>>> On 5 September 2015 at 00:55, Ole Ersoy <ol...@gmail.com> 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: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Gilles <gi...@harfang.homelinux.org>.
On Sat, 5 Sep 2015 02:14:03 +0100, sebb wrote:
> On 5 September 2015 at 01:13, Gilles <gi...@harfang.homelinux.org> 
> wrote:
>> On Sat, 5 Sep 2015 00:56:54 +0100, sebb wrote:
>>>
>>> On 5 September 2015 at 00:55, Ole Ersoy <ol...@gmail.com> 
>>> 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)
>

Sorry but I think that we don't talk about the same thing.
The problem here has nothing to do with released material.

The files I'm talking about are not under source control; but they are
present in in my (local) source tree, in the right place for testing 
new
features.  When I'm in the right branch (say, "math3"), all is fine.
When I switch branch, the (git-managed) source tree rooted at "math3"
disappears, except, of course, those files (which are not yet tracked 
by
git).

Note that this is temporary: when preliminary testing is satisfactory,
I'd "git add" the files, and they will also disappear when switching
branch.
The problem is that when doing "parallel" work (like the tedious
"backporting" currently going on in CM), those files stay in the way.

And as they happen to end with ".java", maven wants to compile them
(of course), and fails when in the "wrong" branch?
My suggestion is that maven could be told to just ignore them, just
the same as it ignores any non Java files that could also happen to
be there.


Gilles


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by sebb <se...@gmail.com>.
On 5 September 2015 at 01:13, Gilles <gi...@harfang.homelinux.org> wrote:
> On Sat, 5 Sep 2015 00:56:54 +0100, sebb wrote:
>>
>> On 5 September 2015 at 00:55, Ole Ersoy <ol...@gmail.com> 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: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Gilles <gi...@harfang.homelinux.org>.
On Sat, 5 Sep 2015 00:56:54 +0100, sebb wrote:
> On 5 September 2015 at 00:55, Ole Ersoy <ol...@gmail.com> 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: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by sebb <se...@gmail.com>.
On 5 September 2015 at 00:55, Ole Ersoy <ol...@gmail.com> 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: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Ole Ersoy <ol...@gmail.com>.

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: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Gilles <gi...@harfang.homelinux.org>.
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: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Ole Ersoy <ol...@gmail.com>.

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 <gi...@harfang.homelinux.org> 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: dev-unsubscribe@commons.apache.org
>>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
> .
>


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

Posted by Gilles <gi...@harfang.homelinux.org>.
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 <gi...@harfang.homelinux.org> 
>> 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: dev-unsubscribe@commons.apache.org
>>> For additional commands, e-mail: dev-help@commons.apache.org
>>>
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Ole Ersoy <ol...@gmail.com>.
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 <gi...@harfang.homelinux.org> 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: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Gilles <gi...@harfang.homelinux.org>.
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 <gi...@harfang.homelinux.org>
>>> wrote:
>>>> Hi.
>>>>
>>>>
>>>> On Fri, 4 Sep 2015 15:30:57 +0100, sebb wrote:
>>>>>
>>>>> On 4 September 2015 at 14:08, Gilles 
>>>>> <gi...@harfang.homelinux.org>
>>>>> 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: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Luc Maisonobe <lu...@spaceroots.org>.
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 <gi...@harfang.homelinux.org>
>> wrote:
>>> Hi.
>>>
>>>
>>> On Fri, 4 Sep 2015 15:30:57 +0100, sebb wrote:
>>>>
>>>> On 4 September 2015 at 14:08, Gilles <gi...@harfang.homelinux.org>
>>>> 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: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Gilles <gi...@harfang.homelinux.org>.
On Fri, 4 Sep 2015 18:30:45 +0100, sebb wrote:
> On 4 September 2015 at 16:30, Gilles <gi...@harfang.homelinux.org> 
> wrote:
>> On Fri, 4 Sep 2015 16:26:16 +0100, sebb wrote:
>>>
>>> On 4 September 2015 at 15:42, Gilles <gi...@harfang.homelinux.org> 
>>> wrote:
>>>>
>>>> Hi.
>>>>
>>>>
>>>> On Fri, 4 Sep 2015 15:30:57 +0100, sebb wrote:
>>>>>
>>>>>
>>>>> On 4 September 2015 at 14:08, Gilles 
>>>>> <gi...@harfang.homelinux.org>
>>>>> 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: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by sebb <se...@gmail.com>.
On 4 September 2015 at 16:30, Gilles <gi...@harfang.homelinux.org> wrote:
> On Fri, 4 Sep 2015 16:26:16 +0100, sebb wrote:
>>
>> On 4 September 2015 at 15:42, Gilles <gi...@harfang.homelinux.org> wrote:
>>>
>>> Hi.
>>>
>>>
>>> On Fri, 4 Sep 2015 15:30:57 +0100, sebb wrote:
>>>>
>>>>
>>>> On 4 September 2015 at 14:08, Gilles <gi...@harfang.homelinux.org>
>>>> 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: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Gilles <gi...@harfang.homelinux.org>.
On Fri, 4 Sep 2015 16:26:16 +0100, sebb wrote:
> On 4 September 2015 at 15:42, Gilles <gi...@harfang.homelinux.org> 
> wrote:
>> Hi.
>>
>>
>> On Fri, 4 Sep 2015 15:30:57 +0100, sebb wrote:
>>>
>>> On 4 September 2015 at 14:08, Gilles <gi...@harfang.homelinux.org> 
>>> 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: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by sebb <se...@gmail.com>.
On 4 September 2015 at 15:42, Gilles <gi...@harfang.homelinux.org> wrote:
> Hi.
>
>
> On Fri, 4 Sep 2015 15:30:57 +0100, sebb wrote:
>>
>> On 4 September 2015 at 14:08, Gilles <gi...@harfang.homelinux.org> 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: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Gilles <gi...@harfang.homelinux.org>.
Hi.

On Fri, 4 Sep 2015 15:30:57 +0100, sebb wrote:
> On 4 September 2015 at 14:08, Gilles <gi...@harfang.homelinux.org> 
> 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: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by sebb <se...@gmail.com>.
On 4 September 2015 at 14:08, Gilles <gi...@harfang.homelinux.org> 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: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Phil Steitz <ph...@gmail.com>.
On 9/5/15 10:28 AM, Luc Maisonobe wrote:
> Le 05/09/2015 01:47, Gilles a écrit :
>> 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)...
> When I port a change from math3 to math4 (or the other way round), what
> I do is:
>
>  - do all the work in one version, including git commit
>  - once a change is committed in one version, I create the
>    path file for the other version with something like:
>
>      git diff -p HEAD~1 HEAD | sed 's,math3,math4,g' > /tmp/x.patch
>
>  - then I swith to the other version
>
>      git checkout master
>
>  - then I applied the patch that already contains the updated number
>
>      patch -p1 < /tmp/x.patch
>
>  - then I commit it in this branch
>
>      commit -m "the message for the commit'
>
> It works quite well.

I do the same thing, except that I generate the patch before the
first commit, so I don't need the additional arguments to the git
diff.  Now and then the patches don't apply cleanly, but that's to
be expected when refactoring has happened in master.

Phil
>
> best regards,
> Luc
>
>>> 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: dev-unsubscribe@commons.apache.org
>> For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


[Math] LeastSquaresOptimizer Javadoc

Posted by Ole Ersoy <ol...@gmail.com>.
Reviewing the math4 leastsquares code ATM, and the class level javadoc for LeastSquaresOptimizer states:

==========================================
An algorithm that can be applied to a non-linear least squares problem.
==========================================

How about:

----------------------------------------------------------------------------------------------
Interface for algorithms that solve least squares problems.
----------------------------------------------------------------------------------------------

And the optimize method:

==========================================
Solve the non-linear least squares problem.
==========================================

 >>

----------------------------------------------------------------------------------------------
Solve the least squares problem.
----------------------------------------------------------------------------------------------

Cheers,
- Ole



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Luc Maisonobe <lu...@spaceroots.org>.
Le 13/09/2015 01:22, Gilles a écrit :
> Hi.
> 
> On Sat, 05 Sep 2015 19:28:33 +0200, Luc Maisonobe wrote:
>> Le 05/09/2015 01:47, Gilles a écrit :
>>> 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)...
>>
>> When I port a change from math3 to math4 (or the other way round), what
>> I do is:
>>
>>  - do all the work in one version, including git commit
>>  - once a change is committed in one version, I create the
>>    path file for the other version with something like:
>>
>>      git diff -p HEAD~1 HEAD | sed 's,math3,math4,g' > /tmp/x.patch
> 
> What would it become when several commits are to be ported (interleaved
> with commits on other issues)?

In fact, there is even a simpler solution, in one line and
without creating the intermediate patch file:

Suppose you want to import commit 12345 from branch MATH_3_X to master.
Then you swith to master with

  git checkout master

and you port the commit directly:

  git diff -p 12345~1 12345 | sed 's,math3,math4,g' | path -p1

This works even if commit 12345 is not the latest one. Here the notation
12345~1 means "the commit before 12345", so the command really ports
one commit only here. If you want to create one patch from several
successive commits at once, you can use ~2, ~3, ... at will. You can
also use directly commit numbers. If you want to port only some commits
and not other interleaved commits, you should use the command several
times with carefully picked commits ranges corresponding only to the
ones you want, taking care to avoid the ones that should not be ported.

This command only modifies your workspace, it does not do the commit
in the master branch. This means that if you use the command twice to
port two commits, they will be combined as only one commit if you
don't run git commit by yourself between the two patch commands.

best regards,
Luc

> 
> Thanks,
> Gilles
> 
>>
>>  - then I swith to the other version
>>
>>      git checkout master
>>
>>  - then I applied the patch that already contains the updated number
>>
>>      patch -p1 < /tmp/x.patch
>>
>>  - then I commit it in this branch
>>
>>      commit -m "the message for the commit'
>>
>> It works quite well.
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Al Chou <ho...@yahoo.com.INVALID>.
Oh, yeah.  Well, after bringing the commits over via cherry-pick, the files could be edited to fix the package name and then committed, and then optionally interactive-rebased to squash the commits together.  But the above is equivalent to your patch strategy.  I do highly recommend interactive rebasing as a tool to keep in mind, even if you don't employ it in this use case.  http://ProGit.org/book is a great, easy to read resource.


Al

From:"Luc Maisonobe" <lu...@spaceroots.org>
Date:Sun, Sep 13, 2015 at 4:26
Subject:Re: [Math] Compile only top-level package and below

Hi Al,
Le 13/09/2015 03:17, Al Chou a écrit :
> You could use `git cherry-pick` to bring one or more commits from one branch into another.

Unfortunately, this does not work here, due to package renaming.

Luc



> 
> Al


> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org




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

Posted by Luc Maisonobe <lu...@spaceroots.org>.
Hi Al,
Le 13/09/2015 03:17, Al Chou a écrit :
> You could use `git cherry-pick` to bring one or more commits from one branch into another.

Unfortunately, this does not work here, due to package renaming.

Luc

> 
> Al
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Al Chou <ho...@yahoo.com.INVALID>.
You could use `git cherry-pick` to bring one or more commits from one branch into another.

Al

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

Posted by Al Chou <ho...@yahoo.com.INVALID>.
There are several ways one could address this situation; I think I would simply create a new branch in Git and commit those new files only on that branch.

Al

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

Posted by Gilles <gi...@harfang.homelinux.org>.
Hi.

On Sat, 05 Sep 2015 19:28:33 +0200, Luc Maisonobe wrote:
> Le 05/09/2015 01:47, Gilles a écrit :
>> 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)...
>
> When I port a change from math3 to math4 (or the other way round), 
> what
> I do is:
>
>  - do all the work in one version, including git commit
>  - once a change is committed in one version, I create the
>    path file for the other version with something like:
>
>      git diff -p HEAD~1 HEAD | sed 's,math3,math4,g' > /tmp/x.patch

What would it become when several commits are to be ported (interleaved
with commits on other issues)?

Thanks,
Gilles

>
>  - then I swith to the other version
>
>      git checkout master
>
>  - then I applied the patch that already contains the updated number
>
>      patch -p1 < /tmp/x.patch
>
>  - then I commit it in this branch
>
>      commit -m "the message for the commit'
>
> It works quite well.
>


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Luc Maisonobe <lu...@spaceroots.org>.
Le 05/09/2015 01:47, Gilles a écrit :
> 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)...

When I port a change from math3 to math4 (or the other way round), what
I do is:

 - do all the work in one version, including git commit
 - once a change is committed in one version, I create the
   path file for the other version with something like:

     git diff -p HEAD~1 HEAD | sed 's,math3,math4,g' > /tmp/x.patch

 - then I swith to the other version

     git checkout master

 - then I applied the patch that already contains the updated number

     patch -p1 < /tmp/x.patch

 - then I commit it in this branch

     commit -m "the message for the commit'

It works quite well.

best regards,
Luc

> 
>>
>> 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: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Gilles <gi...@harfang.homelinux.org>.
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: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


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

Posted by Thomas Neidhart <th...@gmail.com>.
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: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org