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


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




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


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

.


Reply via email to