commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sebb <seb...@gmail.com>
Subject Re: [Math] Maven profile for running the examples?
Date Tue, 06 Jan 2015 12:28:46 GMT
On 6 January 2015 at 11:58, Gilles <gilles@harfang.homelinux.org> wrote:
> On Tue, 06 Jan 2015 08:51:32 +0100, Thomas Neidhart wrote:
>>
>> On 01/05/2015 11:58 PM, Gilles wrote:
>>>
>>> On Mon, 5 Jan 2015 23:48:43 +0100, Bernd Eckenfels wrote:
>>>>
>>>> Am Mon, 05 Jan 2015 23:35:49 +0100
>>>> schrieb Gilles <gilles@harfang.homelinux.org>:
>>>>
>>>>> Which docs?
>>>>> I didn't intend to move the "userguide" document; only the Java
>>>>> examples currently under "src/userguide/java" would be moved to
>>>>>    "src/main"
>>>>
>>>>
>>>> I wont mention multiple modules (also this might be a case where it
>>>> makes sense, especially if you want to create a dedicated example jar
>>>> file with its own set of dependencies and as it might avoid calling
>>>> ant scripts for it), but I would keep the source separated and rather
>>>> add an additional source directory (with the buildhelper).
>>>>
>>>> <plugin>
>>>>     <groupId>org.codehaus.mojo</groupId>
>>>>     <artifactId>build-helper-maven-plugin</artifactId>
>>>>     <executions>
>>>>         <execution>
>>>>             <phase>initialize</phase>
>>>>             <goals><goal>add-source</goal></goals>
>>>>             <configuration>
>>>>                 <sources>
>>>>                     <source>src/userguide/java</source>
>>>>                 </sources>
>>>>             </configuration>
>>>>         </execution>
>>>>     </executions>
>>>> </plugin>
>>>>
>>>> NB: this will produce classes on target/classes so you need to exclude
>>>> them in the JAR.
>>>>
>>>
>>> Thanks.
>>> I find it cleaner to keep the examples separated from the "main" code;
>>> so if this does the trick, I'd prefer it that way.
>>> We'd nevertheless need that separate JAR that contains the examples,
>>> and a mean to select which of the examples must be run, as proposed
>>> by Sebb.
>>
>>
>> The examples can not be added to the main code as there is an additional
>> dependency (xchart) that we do not want to add to commons-math in general.
>
>
> It was never intended to ship the examples as part of the CM
> library. [There are provisions in the "pom.xml" to prevent it (IIUC).]

This is also true of NET. The examples are shipped, but in a separate jar.

> IIUC, Sebb proposed that the source code be moved solely for
> the purpose that maven would compile it with the default config.

Yes; and it's easier for IDEs that way.

> IIUC, with Bernd's proposal, this move is thus not necessary.

Yes.

>> An option would be to add it as part of the test code and use the "test"
>> scope for the dependency but for exactly this reason it was decided to
>> keep the two things apart (commons-math, userguide).
>
>
> I have no problem with that, quite the contrary as I write above.
>
> The original issue was: How do we run the examples?
> Phil proposed an "ant" script, which I would have happily produced.
> But then if "maven" can do it (with the suggested changes to the
> "pom.xml"), it's IMO simpler to not have to run a different program.

Note that the NET pom changes only relate to the separate packaging of
the examples.
There is no provision currently for running the examples via Maven.

The NET examples can be run using Java - no need for Maven or Ant.

Just download the examples and main net jars and store them in the
same directory.
The use Java (which must be available, unlike Ant or Maven)

java -jar examples.jar exampleName parameters

There is also a Maven exec:java target that might be usable.
However it is a bit awkward passing in examples:

mvn -q exec:java -Dexec.arguments=a,b,c

>
> 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


Mime
View raw message