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/01/04 19:21:56 UTC
[Math] Maven profile for running the examples?
Hi.
In the "src/userguide/java" directory, there are a few
self-contained usage examples.
I think that we should have some way to
1. automatically compile its content (so that we can ensure that the
source tree does not contain any non-compilable stuff) and
2. run selected classes (so that users easily see CM code at work)
It looks like it should not be too difficult (for an experienced
maven user, which I'm not) to create a profile for doing just that.
[I've seen there is an "exec" plugin that could do (2), but I
didn't find where, in the "pom.xml", one can specify an alternate
directory for indicating which sources to compile.]
Thanks for any hint,
Gilles
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by Luc Maisonobe <lu...@spaceroots.org>.
Le 04/01/2015 21:05, Phil Steitz a écrit :
>
>
>
>
>> On Jan 4, 2015, at 11:21 AM, Gilles <gi...@harfang.homelinux.org> wrote:
>>
>> Hi.
>>
>> In the "src/userguide/java" directory, there are a few
>> self-contained usage examples.
>>
>> I think that we should have some way to
>> 1. automatically compile its content (so that we can ensure that the
>> source tree does not contain any non-compilable stuff) and
>> 2. run selected classes (so that users easily see CM code at work)
>>
>> It looks like it should not be too difficult (for an experienced
>> maven user, which I'm not) to create a profile for doing just that.
>> [I've seen there is an "exec" plugin that could do (2), but I
>> didn't find where, in the "pom.xml", one can specify an alternate
>> directory for indicating which sources to compile.]
>
> This kind of thing is pretty easy in Ant. I would be +1 on just adding a build.xml to the directory where the examples live.
It seems the tools jar is created in our pom by using
maven-antrun-plugin. It contains the PerfTestUtils class from the tests.
I don't
remember what is is for. This may be a way to do what you want.
best regards,
Luc
>
> Phil
>>
>>
>> Thanks for any hint,
>> 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] Maven profile for running the examples?
Posted by Phil Steitz <ph...@gmail.com>.
> On Jan 4, 2015, at 11:21 AM, Gilles <gi...@harfang.homelinux.org> wrote:
>
> Hi.
>
> In the "src/userguide/java" directory, there are a few
> self-contained usage examples.
>
> I think that we should have some way to
> 1. automatically compile its content (so that we can ensure that the
> source tree does not contain any non-compilable stuff) and
> 2. run selected classes (so that users easily see CM code at work)
>
> It looks like it should not be too difficult (for an experienced
> maven user, which I'm not) to create a profile for doing just that.
> [I've seen there is an "exec" plugin that could do (2), but I
> didn't find where, in the "pom.xml", one can specify an alternate
> directory for indicating which sources to compile.]
This kind of thing is pretty easy in Ant. I would be +1 on just adding a build.xml to the directory where the examples live.
Phil
>
>
> Thanks for any hint,
> 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] Maven profile for running the examples?
Posted by Gilles <gi...@harfang.homelinux.org>.
On Sun, 4 Jan 2015 20:31:30 +0000, sebb wrote:
> Did you see my mail from earlier today titled as below ?
>
> Compiling and running examples
No, I missed it!
> This explains how Commons NET examples are built and used.
Thanks for the reminder,
Gilles
> On 4 January 2015 at 18:21, Gilles <gi...@harfang.homelinux.org>
> wrote:
>> Hi.
>>
>> In the "src/userguide/java" directory, there are a few
>> self-contained usage examples.
>>
>> I think that we should have some way to
>> 1. automatically compile its content (so that we can ensure that the
>> source tree does not contain any non-compilable stuff) and
>> 2. run selected classes (so that users easily see CM code at work)
>>
>> It looks like it should not be too difficult (for an experienced
>> maven user, which I'm not) to create a profile for doing just that.
>> [I've seen there is an "exec" plugin that could do (2), but I
>> didn't find where, in the "pom.xml", one can specify an alternate
>> directory for indicating which sources to compile.]
>>
>>
>> Thanks for any hint,
>> Gilles
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by Thomas Neidhart <th...@gmail.com>.
On 01/06/2015 12:32 PM, sebb wrote:
> On 6 January 2015 at 07:51, Thomas Neidhart <th...@gmail.com> 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 <gi...@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.
>>
>> 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).
>
> Were it not for that, it is easier to set up IDEs if the examples are
> in the same folder structure as main or test.
> Otherwise it is easy to overlook compilation errors in them.
Right now you can add the userguide as separate project to your IDE.
That way you also see compilation errors. Of course, it is not ideal as
problems can still be overlooked, but it was a compromise the get the
whole idea started.
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by sebb <se...@gmail.com>.
On 6 January 2015 at 07:51, Thomas Neidhart <th...@gmail.com> 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 <gi...@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.
>
> 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).
Were it not for that, it is easier to set up IDEs if the examples are
in the same folder structure as main or test.
Otherwise it is easy to overlook compilation errors in them.
> Thomas
>
> ---------------------------------------------------------------------
> 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] Maven profile for running the examples?
Posted by sebb <se...@gmail.com>.
On 6 January 2015 at 11:58, Gilles <gi...@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 <gi...@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
Re: [Math] Maven profile for running the examples?
Posted by Gilles <gi...@harfang.homelinux.org>.
>>>> [...]
>>>> It uses a separate minimal POM, see the JIRA.
>>>> The suggested POM is optional, and assumes the examples jar has
>>>> been
>>>> released to Maven.
>>>
>>>
>>> -1 to release examples jar
>>
>>
>> It was not meant to be the current discussion (cf. earlier posts).
>> [It might become relevant when the examples are more than...
>> examples.]
>>
>> What about my other proposal, about setting up code that generates
>> reports (to be included in the "user guide" document)?
>>
>
> That belongs in a new thread with a new title ...
Then, so does the part about publishing the examples.
The original issue was to _run_ them for checking that the examples
are compilable and produce the expected output.
Namely, for the purpose of creating examples that output informative
reports (see above).
>>>>> Users of CM that don't use maven, would be forced to install it,
>>>>> if
>>>>> they want to run the examples.
>>>>
>>>> No, there is no need to install Maven if CM releases the examples
>>>> as a
>>>> jar.
>>>> [However obviously the MATH-1187 POM would be no use to them.]
>>>>
>>>> But if CM does not release the examples jar then a CM user that
>>>> does
>>>> not want to install Maven may have a problem.
>>>>
>>>> The standard way to build CM Math from source is to use Maven.
>>>> So unless CM provides a separate build method (Ant, or setup files
>>>> for
>>>> different IDEs, or shell scripts for different OSes)
>>>
>>>
>>> Math has a working Ant build.
>>>
>>>> the user is going
>>>> to have to work out how to build the examples for themselves.
>>>> [CM can provide written build instructions, but the user would
>>>> have to
>>>> translate those into their own build tools]
>>>>
>>>> And (to state the obvious) if a CM user only has runtime Java and
>>>> does
>>>> not want to install a JDK, then their only hope is if CM Math
>>>> releases
>>>> the examples as a compiled jar.
>>>>
>>>> In the case of a CM user without Maven, the user needs to be told
>>>> what
>>>> dependencies are needed by the examples.
>>>> They then need to download all the dependencies and ensure that
>>>> they
>>>> are available on the classpath when running the examples.
>>>>
>>>> One way to do this is to ensure that the jars are all in the same
>>>> directory.
>>>> The examples jar manifest can include a Classpath entry which can
>>>> list
>>>> the jars; there is then no need to list them on the java command
>>>> line
>>>> (and possibly not in the pom dependency section either)
>>>> And if the manifest has a Main-Class entry, it can be invoked as
>>>> follows:
>>>
>>>
>>> Or use an Ant get-deps task like the math build itself does. Ant
>>> is
>>> a way better tool for this kind of thing than maven, IMO.
>>
>>
>> I'd prefer the minimum number of ways to achieve the goal.
>
> To optimise a solution, one generally needs to know what all the
> possible solutions are.
> Or at least a few, in order to pick the least worst.
I don't mind your experimenting; the remark was about having one
final choice (which could be changed over time if necessary).
>> If we don't release the examples, ever, then the "maven -q
>> exec:java"
>> way is fine (since the developers most likely have maven installed).
>
> Yes, but there are still options here.
> Having to quote the full name of the class is tedious, so perhaps
> need
> to look at options for simplifying that.
If there are several choices, one has to "tell" the JVM what one wants;
one way or another, it won't get any significantly shorter.
>> If we release something (e.g. part of the examples), it looks like
>> the simplest and safest way (license-wise) is to write down the list
>> of dependencies and let the users use "whatever" to collect the
>> dependencies and run the code...
>
> In that case, adding the dependencies to the manifest as Class-Path
> entries makes it very easy for the end-user.
> No need to create a shell script to set up the class path.
Maybe, maybe; but didn't we say it won't be published for now?
I think that we are good with "mvn -q exec ..."
Regards,
Gilles
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by sebb <se...@gmail.com>.
On 13 January 2015 at 18:40, Gilles <gi...@harfang.homelinux.org> wrote:
> On Tue, 13 Jan 2015 11:03:42 -0700, Phil Steitz wrote:
>>
>> On 1/13/15 10:48 AM, sebb wrote:
>>>
>>> On 13 January 2015 at 12:44, Gilles <gi...@harfang.homelinux.org> wrote:
>>>>
>>>> On Thu, 8 Jan 2015 15:49:31 +0000, sebb wrote:
>>>>>
>>>>> On 8 January 2015 at 11:59, Gilles <gi...@harfang.homelinux.org>
>>>>> wrote:
>>>>>>
>>>>>> On Thu, 8 Jan 2015 01:20:20 +0000, sebb wrote:
>>>>>>>
>>>>>>>
>>>>>>> On 8 January 2015 at 00:25, Gilles <gi...@harfang.homelinux.org>
>>>>>>> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> On Wed, 7 Jan 2015 17:21:33 +0000, sebb wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 7 January 2015 at 17:12, Thomas Neidhart
>>>>>>>>> <th...@gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 01/07/2015 06:00 PM, sebb wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On 7 January 2015 at 16:29, Thomas Neidhart
>>>>>>>>>>> <th...@gmail.com>
>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On 01/07/2015 04:50 PM, sebb wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 7 January 2015 at 13:59, Gilles
>>>>>>>>>>>>> <gi...@harfang.homelinux.org>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> [...]
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> I have pushed the change to the userguide. To execute the
>>>>>>>>>>>>>>> example
>>>>>>>>>>>>>>> you do
>>>>>>>>>>>>>>> the following:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> * go to commons-math folder, type mvn clean install
>>>>>>>>>>>>>>> this step is only needed if your local maven repository
>>>>>>>>>>>>>>> does
>>>>>>>>>>>>>>> not
>>>>>>>>>>>>>>> yet
>>>>>>>>>>>>>>> contain the latest commons-math snapshot
>>>>>>>>>>>>>>> * go to userguide folder (src/userguide), type mvn clean
>>>>>>>>>>>>>>> package
>>>>>>>>>>>>>>> * now you can run the examples like that:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> java -cp target/commons-math3-examples-uber-3.5-SNAPSHOT.jar
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Very nice.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Yes, however there is a caveat.
>>>>>>>>>>>>> The uber jar must not be published, at least in its current
>>>>>>>>>>>>> form.
>>>>>>>>>>>>> - it contains un-shaded classes that have different Maven
>>>>>>>>>>>>> coords
>>>>>>>>>>>>> (=>
>>>>>>>>>>>>> jar hell)
>>>>>>>>>>>>> - it does not have N&L files
>>>>>>>>>>>>> - are the 3rd party jars AL compatible?
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> there is no intention to publish the uber jar.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> OK.
>>>>>>>>>>>
>>>>>>>>>>>>> There is another way to run the code without needing to
>>>>>>>>>>>>> generate
>>>>>>>>>>>>> the
>>>>>>>>>>>>> jars:
>>>>>>>>>>>>>
>>>>>>>>>>>>> cd src/userguide
>>>>>>>>>>>>>
>>>>>>>>>>>>> mvn -q exec:java
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> -Dexec.mainClass=org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> nice, did not know this trick before.
>>>>>>>>>>>>
>>>>>>>>>>>>> This uses Maven to resolve the dependencies.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Works very well for developer testing of examples.
>>>>>>>>>>>>> However it is not so useful for end users as they would need
>>>>>>>>>>>>> Maven
>>>>>>>>>>>>> and
>>>>>>>>>>>>> the Math source.
>>>>>>>>>>>>>
>>>>>>>>>>>>> The NET jar method works well because there are no external
>>>>>>>>>>>>> dependencies, and the example jar is created in the same
>>>>>>>>>>>>> directory
>>>>>>>>>>>>> as
>>>>>>>>>>>>> the core jar it depends on.
>>>>>>>>>>>>>
>>>>>>>>>>>>> The same approach would work for Math, but the user would have
>>>>>>>>>>>>> to
>>>>>>>>>>>>> download the additional dependencies somehow.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> the approach with exec:java is good enough imho, as >90% of the
>>>>>>>>>>>> users
>>>>>>>>>>>> will have maven installed.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Agreed.
>>>>>>>> It's safe to assume that (see below for the proposed usage).
>>>>>>>>
>>>>>>>>>>> But they won't necessarily have the Math source.
>>>>>>>>>>>
>>>>>>>>>>> On a whim I just tried creating a basic pom with only the
>>>>>>>>>>> dependencies.
>>>>>>>>>>> I added examples as another dependency.
>>>>>>>>>>>
>>>>>>>>>>> This works fine with exec:java from any directory provided only
>>>>>>>>>>> that
>>>>>>>>>>> the examples have been installed (or can be found from a repo)
>>>>>>>>>>>
>>>>>>>>>>> A minor disadvantage of exec:java is one has to use properties
>>>>>>>>>>> for
>>>>>>>>>>> the
>>>>>>>>>>> main class and arguments - the syntax is a bit awkward.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> I did not follow the details (e.g. what is "uber"?) but IMHO, one
>>>>>>>> simple
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> The uber jar is a jar that contains the examples classes and all its
>>>>>>> dependencies.
>>>>>>>
>>>>>>>> enough way is enough; the simpler the "pom.xml" the better (perhaps
>>>>>>>> with
>>>>>>>> a little README in the same directory).
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> The src/userguide/pom.xml compiles the examples and creates the uber
>>>>>>> jar.
>>>>>>> The section that creates the uber jar could be dropped and it would
>>>>>>> still be suitable for use with exec:java
>>>>>>>
>>>>>>>>>> the examples are also not published (yet), thus there is no way to
>>>>>>>>>> run
>>>>>>>>>> the examples without downloading the source distribution (or
>>>>>>>>>> checkout
>>>>>>>>>> the git repo).
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Yes, but the code we are discussing is for the next release.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Not necessarily.
>>>>>>>> The first step was necessarily to be able to compile and run them
>>>>>>>> for ourselves.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> OK
>>>>>>>
>>>>>>>>> I think it would make sense to include the compiled examples in the
>>>>>>>>> release as a separate jar.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> IMO, the setup in the "src/userguide" can have at least two purposes
>>>>>>>> that are more useful than publishing the compiled examples:
>>>>>>>> 1. Generate reports (on various aspects of CM) to be integrated in
>>>>>>>> "userguide" document. [For this, the build must run the code
>>>>>>>> that generates the reports.]
>>>>>>>> 2. Publish source code of working examples. [For this, the RM
>>>>>>>> must of course ensure that the code is correct (i.e. compiles
>>>>>>>> and runs as expected).]
>>>>>>>>
>>>>>>>> Providing compiled code is only useful if the examples are more
>>>>>>>> than just toy problems, and provide readily useful functionalities:
>>>>>>>> a library of real-world applications (in which the name "examples"
>>>>>>>> won't be appropriate anymore). [We are not there yet (the idea of
>>>>>>>> real-world examples was proposed quite some time ago but did not
>>>>>>>> elicit any comment IIRC).]
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> By contrast the NET examples are all (or mostly) usable.
>>>>>>>
>>>>>>>> Points (1) and (2) would add to the resources which a newcomer
>>>>>>>> might like to read to get acquainted with the contents of the
>>>>>>>> library. The document should be readily available without a
>>>>>>>> prospective user having to run anything.
>>>>>>>>
>>>>>>> Well of course.
>>>>>>
>>>>>>
>>>>>>
>>>>>> So we need to set up a list of desirable reports...
>>>>>> [One that comes to mind is a benchmark of FastMath.]
>>>>>>
>>>>>>> If the examples were extended to include useful utilities, then I
>>>>>>> suspect you would find some people wanted to be able to run them
>>>>>>> without needing to install Maven and a JDK.
>>>>>>> In which case one way to do this is via a uber jar.
>>>>>>> That would only require a Java runtime.
>>>>>>
>>>>>>
>>>>>>
>>>>>> I understand, but since there are no such utilities, better avoid
>>>>>> potential license problems. I.e. let's first decide which examples
>>>>>> are broadly, then publish only those when the time comes, and this
>>>>>> in turn will require more fine-grained control of the build.
>>>>>> So IMHO, it's better to remove the "uber" setup (if just so that
>>>>>> we limit the things that might break, or that the thing that might
>>>>>> break will be discovered sooner since we'd all use the same tool).
>>>>>>
>>>>>>> If such examples did not need external dependencies, then the NET
>>>>>>> approach would work.
>>>>>>
>>>>>>
>>>>>>
>>>>>> And, as suggested above, perhaps that the published compiled
>>>>>> examples won't have the problematic dependencies...
>>>>>
>>>>>
>>>>> There's another way round the uber jar. Requires Maven and Java
>>>>> runtime but not JDK.
>>>>>
>>>>> That is to provide the dependency POM I mentioned earlier.
>>>>>
>>>>> It will download the dependencies to the local Maven repo if necessary.
>>>>>
>>>>> I'll add a sample to JIRA so people can try it.
>>>>>
>>> https://issues.apache.org/jira/browse/MATH-1187
>>>
>>>> Do I understand correctly that, for the developers, it will amount to
>>>> modularizing the "pom.xml" without changing the behaviour (of maven),
>>>> and using the same "exec" incantation?
>>>
>>> It uses a separate minimal POM, see the JIRA.
>>> The suggested POM is optional, and assumes the examples jar has been
>>> released to Maven.
>>
>>
>> -1 to release examples jar
>
>
> It was not meant to be the current discussion (cf. earlier posts).
> [It might become relevant when the examples are more than... examples.]
>
> What about my other proposal, about setting up code that generates
> reports (to be included in the "user guide" document)?
>
That belongs in a new thread with a new title ...
>
>>>> Users of CM that don't use maven, would be forced to install it, if
>>>> they want to run the examples.
>>>
>>> No, there is no need to install Maven if CM releases the examples as a
>>> jar.
>>> [However obviously the MATH-1187 POM would be no use to them.]
>>>
>>> But if CM does not release the examples jar then a CM user that does
>>> not want to install Maven may have a problem.
>>>
>>> The standard way to build CM Math from source is to use Maven.
>>> So unless CM provides a separate build method (Ant, or setup files for
>>> different IDEs, or shell scripts for different OSes)
>>
>>
>> Math has a working Ant build.
>>
>>> the user is going
>>> to have to work out how to build the examples for themselves.
>>> [CM can provide written build instructions, but the user would have to
>>> translate those into their own build tools]
>>>
>>> And (to state the obvious) if a CM user only has runtime Java and does
>>> not want to install a JDK, then their only hope is if CM Math releases
>>> the examples as a compiled jar.
>>>
>>> In the case of a CM user without Maven, the user needs to be told what
>>> dependencies are needed by the examples.
>>> They then need to download all the dependencies and ensure that they
>>> are available on the classpath when running the examples.
>>>
>>> One way to do this is to ensure that the jars are all in the same
>>> directory.
>>> The examples jar manifest can include a Classpath entry which can list
>>> the jars; there is then no need to list them on the java command line
>>> (and possibly not in the pom dependency section either)
>>> And if the manifest has a Main-Class entry, it can be invoked as follows:
>>
>>
>> Or use an Ant get-deps task like the math build itself does. Ant is
>> a way better tool for this kind of thing than maven, IMO.
>
>
> I'd prefer the minimum number of ways to achieve the goal.
To optimise a solution, one generally needs to know what all the
possible solutions are.
Or at least a few, in order to pick the least worst.
> If we don't release the examples, ever, then the "maven -q exec:java"
> way is fine (since the developers most likely have maven installed).
Yes, but there are still options here.
Having to quote the full name of the class is tedious, so perhaps need
to look at options for simplifying that.
> If we release something (e.g. part of the examples), it looks like
> the simplest and safest way (license-wise) is to write down the list
> of dependencies and let the users use "whatever" to collect the
> dependencies and run the code...
In that case, adding the dependencies to the manifest as Class-Path
entries makes it very easy for the end-user.
No need to create a shell script to set up the class path.
> Regards,
> Gilles
>
>
>>
>> Phil
>>>
>>>
>>> java -jar examples.jar
>>>
>>> If you want to experiment, I suggest you try downloading the commons-net
>>> jars.
>>>
>>>> [Anyways, we can leave the discussion about what and how to release
>>>> the examples when the time comes...]
>>>
>>> There are various options to try out so I would advise not leaving it
>>> until the last minute.
>>>
>>>>
>>>> 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] Maven profile for running the examples?
Posted by Gilles <gi...@harfang.homelinux.org>.
On Tue, 13 Jan 2015 11:03:42 -0700, Phil Steitz wrote:
> On 1/13/15 10:48 AM, sebb wrote:
>> On 13 January 2015 at 12:44, Gilles <gi...@harfang.homelinux.org>
>> wrote:
>>> On Thu, 8 Jan 2015 15:49:31 +0000, sebb wrote:
>>>> On 8 January 2015 at 11:59, Gilles <gi...@harfang.homelinux.org>
>>>> wrote:
>>>>> On Thu, 8 Jan 2015 01:20:20 +0000, sebb wrote:
>>>>>>
>>>>>> On 8 January 2015 at 00:25, Gilles
>>>>>> <gi...@harfang.homelinux.org> wrote:
>>>>>>>
>>>>>>> On Wed, 7 Jan 2015 17:21:33 +0000, sebb wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> On 7 January 2015 at 17:12, Thomas Neidhart
>>>>>>>> <th...@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 01/07/2015 06:00 PM, sebb wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 7 January 2015 at 16:29, Thomas Neidhart
>>>>>>>>>> <th...@gmail.com>
>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On 01/07/2015 04:50 PM, sebb wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On 7 January 2015 at 13:59, Gilles
>>>>>>>>>>>> <gi...@harfang.homelinux.org>
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> [...]
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I have pushed the change to the userguide. To execute
>>>>>>>>>>>>>> the
>>>>>>>>>>>>>> example
>>>>>>>>>>>>>> you do
>>>>>>>>>>>>>> the following:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> * go to commons-math folder, type mvn clean install
>>>>>>>>>>>>>> this step is only needed if your local maven
>>>>>>>>>>>>>> repository does
>>>>>>>>>>>>>> not
>>>>>>>>>>>>>> yet
>>>>>>>>>>>>>> contain the latest commons-math snapshot
>>>>>>>>>>>>>> * go to userguide folder (src/userguide), type mvn
>>>>>>>>>>>>>> clean
>>>>>>>>>>>>>> package
>>>>>>>>>>>>>> * now you can run the examples like that:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> java -cp
>>>>>>>>>>>>>> target/commons-math3-examples-uber-3.5-SNAPSHOT.jar
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Very nice.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Yes, however there is a caveat.
>>>>>>>>>>>> The uber jar must not be published, at least in its
>>>>>>>>>>>> current form.
>>>>>>>>>>>> - it contains un-shaded classes that have different Maven
>>>>>>>>>>>> coords
>>>>>>>>>>>> (=>
>>>>>>>>>>>> jar hell)
>>>>>>>>>>>> - it does not have N&L files
>>>>>>>>>>>> - are the 3rd party jars AL compatible?
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> there is no intention to publish the uber jar.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> OK.
>>>>>>>>>>
>>>>>>>>>>>> There is another way to run the code without needing to
>>>>>>>>>>>> generate
>>>>>>>>>>>> the
>>>>>>>>>>>> jars:
>>>>>>>>>>>>
>>>>>>>>>>>> cd src/userguide
>>>>>>>>>>>>
>>>>>>>>>>>> mvn -q exec:java
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> -Dexec.mainClass=org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> nice, did not know this trick before.
>>>>>>>>>>>
>>>>>>>>>>>> This uses Maven to resolve the dependencies.
>>>>>>>>>>>>
>>>>>>>>>>>> Works very well for developer testing of examples.
>>>>>>>>>>>> However it is not so useful for end users as they would
>>>>>>>>>>>> need Maven
>>>>>>>>>>>> and
>>>>>>>>>>>> the Math source.
>>>>>>>>>>>>
>>>>>>>>>>>> The NET jar method works well because there are no
>>>>>>>>>>>> external
>>>>>>>>>>>> dependencies, and the example jar is created in the same
>>>>>>>>>>>> directory
>>>>>>>>>>>> as
>>>>>>>>>>>> the core jar it depends on.
>>>>>>>>>>>>
>>>>>>>>>>>> The same approach would work for Math, but the user would
>>>>>>>>>>>> have to
>>>>>>>>>>>> download the additional dependencies somehow.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> the approach with exec:java is good enough imho, as >90% of
>>>>>>>>>>> the
>>>>>>>>>>> users
>>>>>>>>>>> will have maven installed.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Agreed.
>>>>>>> It's safe to assume that (see below for the proposed usage).
>>>>>>>
>>>>>>>>>> But they won't necessarily have the Math source.
>>>>>>>>>>
>>>>>>>>>> On a whim I just tried creating a basic pom with only the
>>>>>>>>>> dependencies.
>>>>>>>>>> I added examples as another dependency.
>>>>>>>>>>
>>>>>>>>>> This works fine with exec:java from any directory provided
>>>>>>>>>> only that
>>>>>>>>>> the examples have been installed (or can be found from a
>>>>>>>>>> repo)
>>>>>>>>>>
>>>>>>>>>> A minor disadvantage of exec:java is one has to use
>>>>>>>>>> properties for
>>>>>>>>>> the
>>>>>>>>>> main class and arguments - the syntax is a bit awkward.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> I did not follow the details (e.g. what is "uber"?) but IMHO,
>>>>>>> one
>>>>>>> simple
>>>>>>
>>>>>>
>>>>>> The uber jar is a jar that contains the examples classes and all
>>>>>> its
>>>>>> dependencies.
>>>>>>
>>>>>>> enough way is enough; the simpler the "pom.xml" the better
>>>>>>> (perhaps
>>>>>>> with
>>>>>>> a little README in the same directory).
>>>>>>
>>>>>>
>>>>>> The src/userguide/pom.xml compiles the examples and creates the
>>>>>> uber
>>>>>> jar.
>>>>>> The section that creates the uber jar could be dropped and it
>>>>>> would
>>>>>> still be suitable for use with exec:java
>>>>>>
>>>>>>>>> the examples are also not published (yet), thus there is no
>>>>>>>>> way to
>>>>>>>>> run
>>>>>>>>> the examples without downloading the source distribution (or
>>>>>>>>> checkout
>>>>>>>>> the git repo).
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Yes, but the code we are discussing is for the next release.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Not necessarily.
>>>>>>> The first step was necessarily to be able to compile and run
>>>>>>> them
>>>>>>> for ourselves.
>>>>>>
>>>>>>
>>>>>> OK
>>>>>>
>>>>>>>> I think it would make sense to include the compiled examples
>>>>>>>> in the
>>>>>>>> release as a separate jar.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> IMO, the setup in the "src/userguide" can have at least two
>>>>>>> purposes
>>>>>>> that are more useful than publishing the compiled examples:
>>>>>>> 1. Generate reports (on various aspects of CM) to be
>>>>>>> integrated in
>>>>>>> "userguide" document. [For this, the build must run the
>>>>>>> code
>>>>>>> that generates the reports.]
>>>>>>> 2. Publish source code of working examples. [For this, the RM
>>>>>>> must of course ensure that the code is correct (i.e.
>>>>>>> compiles
>>>>>>> and runs as expected).]
>>>>>>>
>>>>>>> Providing compiled code is only useful if the examples are more
>>>>>>> than just toy problems, and provide readily useful
>>>>>>> functionalities:
>>>>>>> a library of real-world applications (in which the name
>>>>>>> "examples"
>>>>>>> won't be appropriate anymore). [We are not there yet (the idea
>>>>>>> of
>>>>>>> real-world examples was proposed quite some time ago but did
>>>>>>> not
>>>>>>> elicit any comment IIRC).]
>>>>>>
>>>>>>
>>>>>> By contrast the NET examples are all (or mostly) usable.
>>>>>>
>>>>>>> Points (1) and (2) would add to the resources which a newcomer
>>>>>>> might like to read to get acquainted with the contents of the
>>>>>>> library. The document should be readily available without a
>>>>>>> prospective user having to run anything.
>>>>>>>
>>>>>> Well of course.
>>>>>
>>>>>
>>>>> So we need to set up a list of desirable reports...
>>>>> [One that comes to mind is a benchmark of FastMath.]
>>>>>
>>>>>> If the examples were extended to include useful utilities, then
>>>>>> I
>>>>>> suspect you would find some people wanted to be able to run them
>>>>>> without needing to install Maven and a JDK.
>>>>>> In which case one way to do this is via a uber jar.
>>>>>> That would only require a Java runtime.
>>>>>
>>>>>
>>>>> I understand, but since there are no such utilities, better avoid
>>>>> potential license problems. I.e. let's first decide which
>>>>> examples
>>>>> are broadly, then publish only those when the time comes, and
>>>>> this
>>>>> in turn will require more fine-grained control of the build.
>>>>> So IMHO, it's better to remove the "uber" setup (if just so that
>>>>> we limit the things that might break, or that the thing that
>>>>> might
>>>>> break will be discovered sooner since we'd all use the same
>>>>> tool).
>>>>>
>>>>>> If such examples did not need external dependencies, then the
>>>>>> NET
>>>>>> approach would work.
>>>>>
>>>>>
>>>>> And, as suggested above, perhaps that the published compiled
>>>>> examples won't have the problematic dependencies...
>>>>
>>>> There's another way round the uber jar. Requires Maven and Java
>>>> runtime but not JDK.
>>>>
>>>> That is to provide the dependency POM I mentioned earlier.
>>>>
>>>> It will download the dependencies to the local Maven repo if
>>>> necessary.
>>>>
>>>> I'll add a sample to JIRA so people can try it.
>>>>
>> https://issues.apache.org/jira/browse/MATH-1187
>>
>>> Do I understand correctly that, for the developers, it will amount
>>> to
>>> modularizing the "pom.xml" without changing the behaviour (of
>>> maven),
>>> and using the same "exec" incantation?
>> It uses a separate minimal POM, see the JIRA.
>> The suggested POM is optional, and assumes the examples jar has been
>> released to Maven.
>
> -1 to release examples jar
It was not meant to be the current discussion (cf. earlier posts).
[It might become relevant when the examples are more than... examples.]
What about my other proposal, about setting up code that generates
reports (to be included in the "user guide" document)?
>>> Users of CM that don't use maven, would be forced to install it, if
>>> they want to run the examples.
>> No, there is no need to install Maven if CM releases the examples as
>> a jar.
>> [However obviously the MATH-1187 POM would be no use to them.]
>>
>> But if CM does not release the examples jar then a CM user that does
>> not want to install Maven may have a problem.
>>
>> The standard way to build CM Math from source is to use Maven.
>> So unless CM provides a separate build method (Ant, or setup files
>> for
>> different IDEs, or shell scripts for different OSes)
>
> Math has a working Ant build.
>
>> the user is going
>> to have to work out how to build the examples for themselves.
>> [CM can provide written build instructions, but the user would have
>> to
>> translate those into their own build tools]
>>
>> And (to state the obvious) if a CM user only has runtime Java and
>> does
>> not want to install a JDK, then their only hope is if CM Math
>> releases
>> the examples as a compiled jar.
>>
>> In the case of a CM user without Maven, the user needs to be told
>> what
>> dependencies are needed by the examples.
>> They then need to download all the dependencies and ensure that they
>> are available on the classpath when running the examples.
>>
>> One way to do this is to ensure that the jars are all in the same
>> directory.
>> The examples jar manifest can include a Classpath entry which can
>> list
>> the jars; there is then no need to list them on the java command
>> line
>> (and possibly not in the pom dependency section either)
>> And if the manifest has a Main-Class entry, it can be invoked as
>> follows:
>
> Or use an Ant get-deps task like the math build itself does. Ant is
> a way better tool for this kind of thing than maven, IMO.
I'd prefer the minimum number of ways to achieve the goal.
If we don't release the examples, ever, then the "maven -q exec:java"
way is fine (since the developers most likely have maven installed).
If we release something (e.g. part of the examples), it looks like
the simplest and safest way (license-wise) is to write down the list
of dependencies and let the users use "whatever" to collect the
dependencies and run the code...
Regards,
Gilles
>
> Phil
>>
>> java -jar examples.jar
>>
>> If you want to experiment, I suggest you try downloading the
>> commons-net jars.
>>
>>> [Anyways, we can leave the discussion about what and how to release
>>> the examples when the time comes...]
>> There are various options to try out so I would advise not leaving
>> it
>> until the last minute.
>>
>>>
>>> Gilles
>>>
>>>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by Phil Steitz <ph...@gmail.com>.
On 1/13/15 10:48 AM, sebb wrote:
> On 13 January 2015 at 12:44, Gilles <gi...@harfang.homelinux.org> wrote:
>> On Thu, 8 Jan 2015 15:49:31 +0000, sebb wrote:
>>> On 8 January 2015 at 11:59, Gilles <gi...@harfang.homelinux.org> wrote:
>>>> On Thu, 8 Jan 2015 01:20:20 +0000, sebb wrote:
>>>>>
>>>>> On 8 January 2015 at 00:25, Gilles <gi...@harfang.homelinux.org> wrote:
>>>>>>
>>>>>> On Wed, 7 Jan 2015 17:21:33 +0000, sebb wrote:
>>>>>>>
>>>>>>>
>>>>>>> On 7 January 2015 at 17:12, Thomas Neidhart
>>>>>>> <th...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> On 01/07/2015 06:00 PM, sebb wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 7 January 2015 at 16:29, Thomas Neidhart
>>>>>>>>> <th...@gmail.com>
>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 01/07/2015 04:50 PM, sebb wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On 7 January 2015 at 13:59, Gilles <gi...@harfang.homelinux.org>
>>>>>>>>>>> wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> [...]
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> I have pushed the change to the userguide. To execute the
>>>>>>>>>>>>> example
>>>>>>>>>>>>> you do
>>>>>>>>>>>>> the following:
>>>>>>>>>>>>>
>>>>>>>>>>>>> * go to commons-math folder, type mvn clean install
>>>>>>>>>>>>> this step is only needed if your local maven repository does
>>>>>>>>>>>>> not
>>>>>>>>>>>>> yet
>>>>>>>>>>>>> contain the latest commons-math snapshot
>>>>>>>>>>>>> * go to userguide folder (src/userguide), type mvn clean
>>>>>>>>>>>>> package
>>>>>>>>>>>>> * now you can run the examples like that:
>>>>>>>>>>>>>
>>>>>>>>>>>>> java -cp target/commons-math3-examples-uber-3.5-SNAPSHOT.jar
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Very nice.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Yes, however there is a caveat.
>>>>>>>>>>> The uber jar must not be published, at least in its current form.
>>>>>>>>>>> - it contains un-shaded classes that have different Maven coords
>>>>>>>>>>> (=>
>>>>>>>>>>> jar hell)
>>>>>>>>>>> - it does not have N&L files
>>>>>>>>>>> - are the 3rd party jars AL compatible?
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> there is no intention to publish the uber jar.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> OK.
>>>>>>>>>
>>>>>>>>>>> There is another way to run the code without needing to generate
>>>>>>>>>>> the
>>>>>>>>>>> jars:
>>>>>>>>>>>
>>>>>>>>>>> cd src/userguide
>>>>>>>>>>>
>>>>>>>>>>> mvn -q exec:java
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> -Dexec.mainClass=org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> nice, did not know this trick before.
>>>>>>>>>>
>>>>>>>>>>> This uses Maven to resolve the dependencies.
>>>>>>>>>>>
>>>>>>>>>>> Works very well for developer testing of examples.
>>>>>>>>>>> However it is not so useful for end users as they would need Maven
>>>>>>>>>>> and
>>>>>>>>>>> the Math source.
>>>>>>>>>>>
>>>>>>>>>>> The NET jar method works well because there are no external
>>>>>>>>>>> dependencies, and the example jar is created in the same directory
>>>>>>>>>>> as
>>>>>>>>>>> the core jar it depends on.
>>>>>>>>>>>
>>>>>>>>>>> The same approach would work for Math, but the user would have to
>>>>>>>>>>> download the additional dependencies somehow.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> the approach with exec:java is good enough imho, as >90% of the
>>>>>>>>>> users
>>>>>>>>>> will have maven installed.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Agreed.
>>>>>> It's safe to assume that (see below for the proposed usage).
>>>>>>
>>>>>>>>> But they won't necessarily have the Math source.
>>>>>>>>>
>>>>>>>>> On a whim I just tried creating a basic pom with only the
>>>>>>>>> dependencies.
>>>>>>>>> I added examples as another dependency.
>>>>>>>>>
>>>>>>>>> This works fine with exec:java from any directory provided only that
>>>>>>>>> the examples have been installed (or can be found from a repo)
>>>>>>>>>
>>>>>>>>> A minor disadvantage of exec:java is one has to use properties for
>>>>>>>>> the
>>>>>>>>> main class and arguments - the syntax is a bit awkward.
>>>>>>
>>>>>>
>>>>>>
>>>>>> I did not follow the details (e.g. what is "uber"?) but IMHO, one
>>>>>> simple
>>>>>
>>>>>
>>>>> The uber jar is a jar that contains the examples classes and all its
>>>>> dependencies.
>>>>>
>>>>>> enough way is enough; the simpler the "pom.xml" the better (perhaps
>>>>>> with
>>>>>> a little README in the same directory).
>>>>>
>>>>>
>>>>> The src/userguide/pom.xml compiles the examples and creates the uber
>>>>> jar.
>>>>> The section that creates the uber jar could be dropped and it would
>>>>> still be suitable for use with exec:java
>>>>>
>>>>>>>> the examples are also not published (yet), thus there is no way to
>>>>>>>> run
>>>>>>>> the examples without downloading the source distribution (or checkout
>>>>>>>> the git repo).
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Yes, but the code we are discussing is for the next release.
>>>>>>
>>>>>>
>>>>>>
>>>>>> Not necessarily.
>>>>>> The first step was necessarily to be able to compile and run them
>>>>>> for ourselves.
>>>>>
>>>>>
>>>>> OK
>>>>>
>>>>>>> I think it would make sense to include the compiled examples in the
>>>>>>> release as a separate jar.
>>>>>>
>>>>>>
>>>>>>
>>>>>> IMO, the setup in the "src/userguide" can have at least two purposes
>>>>>> that are more useful than publishing the compiled examples:
>>>>>> 1. Generate reports (on various aspects of CM) to be integrated in
>>>>>> "userguide" document. [For this, the build must run the code
>>>>>> that generates the reports.]
>>>>>> 2. Publish source code of working examples. [For this, the RM
>>>>>> must of course ensure that the code is correct (i.e. compiles
>>>>>> and runs as expected).]
>>>>>>
>>>>>> Providing compiled code is only useful if the examples are more
>>>>>> than just toy problems, and provide readily useful functionalities:
>>>>>> a library of real-world applications (in which the name "examples"
>>>>>> won't be appropriate anymore). [We are not there yet (the idea of
>>>>>> real-world examples was proposed quite some time ago but did not
>>>>>> elicit any comment IIRC).]
>>>>>
>>>>>
>>>>> By contrast the NET examples are all (or mostly) usable.
>>>>>
>>>>>> Points (1) and (2) would add to the resources which a newcomer
>>>>>> might like to read to get acquainted with the contents of the
>>>>>> library. The document should be readily available without a
>>>>>> prospective user having to run anything.
>>>>>>
>>>>> Well of course.
>>>>
>>>>
>>>> So we need to set up a list of desirable reports...
>>>> [One that comes to mind is a benchmark of FastMath.]
>>>>
>>>>> If the examples were extended to include useful utilities, then I
>>>>> suspect you would find some people wanted to be able to run them
>>>>> without needing to install Maven and a JDK.
>>>>> In which case one way to do this is via a uber jar.
>>>>> That would only require a Java runtime.
>>>>
>>>>
>>>> I understand, but since there are no such utilities, better avoid
>>>> potential license problems. I.e. let's first decide which examples
>>>> are broadly, then publish only those when the time comes, and this
>>>> in turn will require more fine-grained control of the build.
>>>> So IMHO, it's better to remove the "uber" setup (if just so that
>>>> we limit the things that might break, or that the thing that might
>>>> break will be discovered sooner since we'd all use the same tool).
>>>>
>>>>> If such examples did not need external dependencies, then the NET
>>>>> approach would work.
>>>>
>>>>
>>>> And, as suggested above, perhaps that the published compiled
>>>> examples won't have the problematic dependencies...
>>>
>>> There's another way round the uber jar. Requires Maven and Java
>>> runtime but not JDK.
>>>
>>> That is to provide the dependency POM I mentioned earlier.
>>>
>>> It will download the dependencies to the local Maven repo if necessary.
>>>
>>> I'll add a sample to JIRA so people can try it.
>>>
> https://issues.apache.org/jira/browse/MATH-1187
>
>> Do I understand correctly that, for the developers, it will amount to
>> modularizing the "pom.xml" without changing the behaviour (of maven),
>> and using the same "exec" incantation?
> It uses a separate minimal POM, see the JIRA.
> The suggested POM is optional, and assumes the examples jar has been
> released to Maven.
-1 to release examples jar
>
>> Users of CM that don't use maven, would be forced to install it, if
>> they want to run the examples.
> No, there is no need to install Maven if CM releases the examples as a jar.
> [However obviously the MATH-1187 POM would be no use to them.]
>
> But if CM does not release the examples jar then a CM user that does
> not want to install Maven may have a problem.
>
> The standard way to build CM Math from source is to use Maven.
> So unless CM provides a separate build method (Ant, or setup files for
> different IDEs, or shell scripts for different OSes)
Math has a working Ant build.
> the user is going
> to have to work out how to build the examples for themselves.
> [CM can provide written build instructions, but the user would have to
> translate those into their own build tools]
>
> And (to state the obvious) if a CM user only has runtime Java and does
> not want to install a JDK, then their only hope is if CM Math releases
> the examples as a compiled jar.
>
> In the case of a CM user without Maven, the user needs to be told what
> dependencies are needed by the examples.
> They then need to download all the dependencies and ensure that they
> are available on the classpath when running the examples.
>
> One way to do this is to ensure that the jars are all in the same directory.
> The examples jar manifest can include a Classpath entry which can list
> the jars; there is then no need to list them on the java command line
> (and possibly not in the pom dependency section either)
> And if the manifest has a Main-Class entry, it can be invoked as follows:
Or use an Ant get-deps task like the math build itself does. Ant is
a way better tool for this kind of thing than maven, IMO.
Phil
>
> java -jar examples.jar
>
> If you want to experiment, I suggest you try downloading the commons-net jars.
>
>> [Anyways, we can leave the discussion about what and how to release
>> the examples when the time comes...]
> There are various options to try out so I would advise not leaving it
> until the last minute.
>
>>
>> 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] Maven profile for running the examples?
Posted by sebb <se...@gmail.com>.
On 13 January 2015 at 12:44, Gilles <gi...@harfang.homelinux.org> wrote:
> On Thu, 8 Jan 2015 15:49:31 +0000, sebb wrote:
>>
>> On 8 January 2015 at 11:59, Gilles <gi...@harfang.homelinux.org> wrote:
>>>
>>> On Thu, 8 Jan 2015 01:20:20 +0000, sebb wrote:
>>>>
>>>>
>>>> On 8 January 2015 at 00:25, Gilles <gi...@harfang.homelinux.org> wrote:
>>>>>
>>>>>
>>>>> On Wed, 7 Jan 2015 17:21:33 +0000, sebb wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 7 January 2015 at 17:12, Thomas Neidhart
>>>>>> <th...@gmail.com> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On 01/07/2015 06:00 PM, sebb wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On 7 January 2015 at 16:29, Thomas Neidhart
>>>>>>>> <th...@gmail.com>
>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 01/07/2015 04:50 PM, sebb wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 7 January 2015 at 13:59, Gilles <gi...@harfang.homelinux.org>
>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> [...]
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> I have pushed the change to the userguide. To execute the
>>>>>>>>>>>> example
>>>>>>>>>>>> you do
>>>>>>>>>>>> the following:
>>>>>>>>>>>>
>>>>>>>>>>>> * go to commons-math folder, type mvn clean install
>>>>>>>>>>>> this step is only needed if your local maven repository does
>>>>>>>>>>>> not
>>>>>>>>>>>> yet
>>>>>>>>>>>> contain the latest commons-math snapshot
>>>>>>>>>>>> * go to userguide folder (src/userguide), type mvn clean
>>>>>>>>>>>> package
>>>>>>>>>>>> * now you can run the examples like that:
>>>>>>>>>>>>
>>>>>>>>>>>> java -cp target/commons-math3-examples-uber-3.5-SNAPSHOT.jar
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Very nice.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Yes, however there is a caveat.
>>>>>>>>>> The uber jar must not be published, at least in its current form.
>>>>>>>>>> - it contains un-shaded classes that have different Maven coords
>>>>>>>>>> (=>
>>>>>>>>>> jar hell)
>>>>>>>>>> - it does not have N&L files
>>>>>>>>>> - are the 3rd party jars AL compatible?
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> there is no intention to publish the uber jar.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> OK.
>>>>>>>>
>>>>>>>>>> There is another way to run the code without needing to generate
>>>>>>>>>> the
>>>>>>>>>> jars:
>>>>>>>>>>
>>>>>>>>>> cd src/userguide
>>>>>>>>>>
>>>>>>>>>> mvn -q exec:java
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> -Dexec.mainClass=org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> nice, did not know this trick before.
>>>>>>>>>
>>>>>>>>>> This uses Maven to resolve the dependencies.
>>>>>>>>>>
>>>>>>>>>> Works very well for developer testing of examples.
>>>>>>>>>> However it is not so useful for end users as they would need Maven
>>>>>>>>>> and
>>>>>>>>>> the Math source.
>>>>>>>>>>
>>>>>>>>>> The NET jar method works well because there are no external
>>>>>>>>>> dependencies, and the example jar is created in the same directory
>>>>>>>>>> as
>>>>>>>>>> the core jar it depends on.
>>>>>>>>>>
>>>>>>>>>> The same approach would work for Math, but the user would have to
>>>>>>>>>> download the additional dependencies somehow.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> the approach with exec:java is good enough imho, as >90% of the
>>>>>>>>> users
>>>>>>>>> will have maven installed.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Agreed.
>>>>> It's safe to assume that (see below for the proposed usage).
>>>>>
>>>>>>>>
>>>>>>>> But they won't necessarily have the Math source.
>>>>>>>>
>>>>>>>> On a whim I just tried creating a basic pom with only the
>>>>>>>> dependencies.
>>>>>>>> I added examples as another dependency.
>>>>>>>>
>>>>>>>> This works fine with exec:java from any directory provided only that
>>>>>>>> the examples have been installed (or can be found from a repo)
>>>>>>>>
>>>>>>>> A minor disadvantage of exec:java is one has to use properties for
>>>>>>>> the
>>>>>>>> main class and arguments - the syntax is a bit awkward.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> I did not follow the details (e.g. what is "uber"?) but IMHO, one
>>>>> simple
>>>>
>>>>
>>>>
>>>> The uber jar is a jar that contains the examples classes and all its
>>>> dependencies.
>>>>
>>>>> enough way is enough; the simpler the "pom.xml" the better (perhaps
>>>>> with
>>>>> a little README in the same directory).
>>>>
>>>>
>>>>
>>>> The src/userguide/pom.xml compiles the examples and creates the uber
>>>> jar.
>>>> The section that creates the uber jar could be dropped and it would
>>>> still be suitable for use with exec:java
>>>>
>>>>>>> the examples are also not published (yet), thus there is no way to
>>>>>>> run
>>>>>>> the examples without downloading the source distribution (or checkout
>>>>>>> the git repo).
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> Yes, but the code we are discussing is for the next release.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> Not necessarily.
>>>>> The first step was necessarily to be able to compile and run them
>>>>> for ourselves.
>>>>
>>>>
>>>>
>>>> OK
>>>>
>>>>>> I think it would make sense to include the compiled examples in the
>>>>>> release as a separate jar.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> IMO, the setup in the "src/userguide" can have at least two purposes
>>>>> that are more useful than publishing the compiled examples:
>>>>> 1. Generate reports (on various aspects of CM) to be integrated in
>>>>> "userguide" document. [For this, the build must run the code
>>>>> that generates the reports.]
>>>>> 2. Publish source code of working examples. [For this, the RM
>>>>> must of course ensure that the code is correct (i.e. compiles
>>>>> and runs as expected).]
>>>>>
>>>>> Providing compiled code is only useful if the examples are more
>>>>> than just toy problems, and provide readily useful functionalities:
>>>>> a library of real-world applications (in which the name "examples"
>>>>> won't be appropriate anymore). [We are not there yet (the idea of
>>>>> real-world examples was proposed quite some time ago but did not
>>>>> elicit any comment IIRC).]
>>>>
>>>>
>>>>
>>>> By contrast the NET examples are all (or mostly) usable.
>>>>
>>>>> Points (1) and (2) would add to the resources which a newcomer
>>>>> might like to read to get acquainted with the contents of the
>>>>> library. The document should be readily available without a
>>>>> prospective user having to run anything.
>>>>>
>>>>
>>>> Well of course.
>>>
>>>
>>>
>>> So we need to set up a list of desirable reports...
>>> [One that comes to mind is a benchmark of FastMath.]
>>>
>>>> If the examples were extended to include useful utilities, then I
>>>> suspect you would find some people wanted to be able to run them
>>>> without needing to install Maven and a JDK.
>>>> In which case one way to do this is via a uber jar.
>>>> That would only require a Java runtime.
>>>
>>>
>>>
>>> I understand, but since there are no such utilities, better avoid
>>> potential license problems. I.e. let's first decide which examples
>>> are broadly, then publish only those when the time comes, and this
>>> in turn will require more fine-grained control of the build.
>>> So IMHO, it's better to remove the "uber" setup (if just so that
>>> we limit the things that might break, or that the thing that might
>>> break will be discovered sooner since we'd all use the same tool).
>>>
>>>>
>>>> If such examples did not need external dependencies, then the NET
>>>> approach would work.
>>>
>>>
>>>
>>> And, as suggested above, perhaps that the published compiled
>>> examples won't have the problematic dependencies...
>>
>>
>> There's another way round the uber jar. Requires Maven and Java
>> runtime but not JDK.
>>
>> That is to provide the dependency POM I mentioned earlier.
>>
>> It will download the dependencies to the local Maven repo if necessary.
>>
>> I'll add a sample to JIRA so people can try it.
>>
https://issues.apache.org/jira/browse/MATH-1187
> Do I understand correctly that, for the developers, it will amount to
> modularizing the "pom.xml" without changing the behaviour (of maven),
> and using the same "exec" incantation?
It uses a separate minimal POM, see the JIRA.
The suggested POM is optional, and assumes the examples jar has been
released to Maven.
> Users of CM that don't use maven, would be forced to install it, if
> they want to run the examples.
No, there is no need to install Maven if CM releases the examples as a jar.
[However obviously the MATH-1187 POM would be no use to them.]
But if CM does not release the examples jar then a CM user that does
not want to install Maven may have a problem.
The standard way to build CM Math from source is to use Maven.
So unless CM provides a separate build method (Ant, or setup files for
different IDEs, or shell scripts for different OSes) the user is going
to have to work out how to build the examples for themselves.
[CM can provide written build instructions, but the user would have to
translate those into their own build tools]
And (to state the obvious) if a CM user only has runtime Java and does
not want to install a JDK, then their only hope is if CM Math releases
the examples as a compiled jar.
In the case of a CM user without Maven, the user needs to be told what
dependencies are needed by the examples.
They then need to download all the dependencies and ensure that they
are available on the classpath when running the examples.
One way to do this is to ensure that the jars are all in the same directory.
The examples jar manifest can include a Classpath entry which can list
the jars; there is then no need to list them on the java command line
(and possibly not in the pom dependency section either)
And if the manifest has a Main-Class entry, it can be invoked as follows:
java -jar examples.jar
If you want to experiment, I suggest you try downloading the commons-net jars.
> [Anyways, we can leave the discussion about what and how to release
> the examples when the time comes...]
There are various options to try out so I would advise not leaving it
until the last minute.
>
>
> 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] Maven profile for running the examples?
Posted by Gilles <gi...@harfang.homelinux.org>.
On Thu, 8 Jan 2015 15:49:31 +0000, sebb wrote:
> On 8 January 2015 at 11:59, Gilles <gi...@harfang.homelinux.org>
> wrote:
>> On Thu, 8 Jan 2015 01:20:20 +0000, sebb wrote:
>>>
>>> On 8 January 2015 at 00:25, Gilles <gi...@harfang.homelinux.org>
>>> wrote:
>>>>
>>>> On Wed, 7 Jan 2015 17:21:33 +0000, sebb wrote:
>>>>>
>>>>>
>>>>> On 7 January 2015 at 17:12, Thomas Neidhart
>>>>> <th...@gmail.com> wrote:
>>>>>>
>>>>>>
>>>>>> On 01/07/2015 06:00 PM, sebb wrote:
>>>>>>>
>>>>>>>
>>>>>>> On 7 January 2015 at 16:29, Thomas Neidhart
>>>>>>> <th...@gmail.com>
>>>>>>> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> On 01/07/2015 04:50 PM, sebb wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 7 January 2015 at 13:59, Gilles
>>>>>>>>> <gi...@harfang.homelinux.org>
>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> [...]
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> I have pushed the change to the userguide. To execute the
>>>>>>>>>>> example
>>>>>>>>>>> you do
>>>>>>>>>>> the following:
>>>>>>>>>>>
>>>>>>>>>>> * go to commons-math folder, type mvn clean install
>>>>>>>>>>> this step is only needed if your local maven repository
>>>>>>>>>>> does
>>>>>>>>>>> not
>>>>>>>>>>> yet
>>>>>>>>>>> contain the latest commons-math snapshot
>>>>>>>>>>> * go to userguide folder (src/userguide), type mvn clean
>>>>>>>>>>> package
>>>>>>>>>>> * now you can run the examples like that:
>>>>>>>>>>>
>>>>>>>>>>> java -cp
>>>>>>>>>>> target/commons-math3-examples-uber-3.5-SNAPSHOT.jar
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Very nice.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Yes, however there is a caveat.
>>>>>>>>> The uber jar must not be published, at least in its current
>>>>>>>>> form.
>>>>>>>>> - it contains un-shaded classes that have different Maven
>>>>>>>>> coords (=>
>>>>>>>>> jar hell)
>>>>>>>>> - it does not have N&L files
>>>>>>>>> - are the 3rd party jars AL compatible?
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> there is no intention to publish the uber jar.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> OK.
>>>>>>>
>>>>>>>>> There is another way to run the code without needing to
>>>>>>>>> generate the
>>>>>>>>> jars:
>>>>>>>>>
>>>>>>>>> cd src/userguide
>>>>>>>>>
>>>>>>>>> mvn -q exec:java
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> -Dexec.mainClass=org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> nice, did not know this trick before.
>>>>>>>>
>>>>>>>>> This uses Maven to resolve the dependencies.
>>>>>>>>>
>>>>>>>>> Works very well for developer testing of examples.
>>>>>>>>> However it is not so useful for end users as they would need
>>>>>>>>> Maven
>>>>>>>>> and
>>>>>>>>> the Math source.
>>>>>>>>>
>>>>>>>>> The NET jar method works well because there are no external
>>>>>>>>> dependencies, and the example jar is created in the same
>>>>>>>>> directory
>>>>>>>>> as
>>>>>>>>> the core jar it depends on.
>>>>>>>>>
>>>>>>>>> The same approach would work for Math, but the user would
>>>>>>>>> have to
>>>>>>>>> download the additional dependencies somehow.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> the approach with exec:java is good enough imho, as >90% of
>>>>>>>> the users
>>>>>>>> will have maven installed.
>>>>
>>>>
>>>>
>>>> Agreed.
>>>> It's safe to assume that (see below for the proposed usage).
>>>>
>>>>>>>
>>>>>>> But they won't necessarily have the Math source.
>>>>>>>
>>>>>>> On a whim I just tried creating a basic pom with only the
>>>>>>> dependencies.
>>>>>>> I added examples as another dependency.
>>>>>>>
>>>>>>> This works fine with exec:java from any directory provided only
>>>>>>> that
>>>>>>> the examples have been installed (or can be found from a repo)
>>>>>>>
>>>>>>> A minor disadvantage of exec:java is one has to use properties
>>>>>>> for the
>>>>>>> main class and arguments - the syntax is a bit awkward.
>>>>
>>>>
>>>>
>>>> I did not follow the details (e.g. what is "uber"?) but IMHO, one
>>>> simple
>>>
>>>
>>> The uber jar is a jar that contains the examples classes and all
>>> its
>>> dependencies.
>>>
>>>> enough way is enough; the simpler the "pom.xml" the better
>>>> (perhaps with
>>>> a little README in the same directory).
>>>
>>>
>>> The src/userguide/pom.xml compiles the examples and creates the
>>> uber jar.
>>> The section that creates the uber jar could be dropped and it would
>>> still be suitable for use with exec:java
>>>
>>>>>> the examples are also not published (yet), thus there is no way
>>>>>> to run
>>>>>> the examples without downloading the source distribution (or
>>>>>> checkout
>>>>>> the git repo).
>>>>>
>>>>>
>>>>>
>>>>> Yes, but the code we are discussing is for the next release.
>>>>
>>>>
>>>>
>>>> Not necessarily.
>>>> The first step was necessarily to be able to compile and run them
>>>> for ourselves.
>>>
>>>
>>> OK
>>>
>>>>> I think it would make sense to include the compiled examples in
>>>>> the
>>>>> release as a separate jar.
>>>>
>>>>
>>>>
>>>> IMO, the setup in the "src/userguide" can have at least two
>>>> purposes
>>>> that are more useful than publishing the compiled examples:
>>>> 1. Generate reports (on various aspects of CM) to be integrated
>>>> in
>>>> "userguide" document. [For this, the build must run the code
>>>> that generates the reports.]
>>>> 2. Publish source code of working examples. [For this, the RM
>>>> must of course ensure that the code is correct (i.e. compiles
>>>> and runs as expected).]
>>>>
>>>> Providing compiled code is only useful if the examples are more
>>>> than just toy problems, and provide readily useful
>>>> functionalities:
>>>> a library of real-world applications (in which the name "examples"
>>>> won't be appropriate anymore). [We are not there yet (the idea of
>>>> real-world examples was proposed quite some time ago but did not
>>>> elicit any comment IIRC).]
>>>
>>>
>>> By contrast the NET examples are all (or mostly) usable.
>>>
>>>> Points (1) and (2) would add to the resources which a newcomer
>>>> might like to read to get acquainted with the contents of the
>>>> library. The document should be readily available without a
>>>> prospective user having to run anything.
>>>>
>>>
>>> Well of course.
>>
>>
>> So we need to set up a list of desirable reports...
>> [One that comes to mind is a benchmark of FastMath.]
>>
>>> If the examples were extended to include useful utilities, then I
>>> suspect you would find some people wanted to be able to run them
>>> without needing to install Maven and a JDK.
>>> In which case one way to do this is via a uber jar.
>>> That would only require a Java runtime.
>>
>>
>> I understand, but since there are no such utilities, better avoid
>> potential license problems. I.e. let's first decide which examples
>> are broadly, then publish only those when the time comes, and this
>> in turn will require more fine-grained control of the build.
>> So IMHO, it's better to remove the "uber" setup (if just so that
>> we limit the things that might break, or that the thing that might
>> break will be discovered sooner since we'd all use the same tool).
>>
>>>
>>> If such examples did not need external dependencies, then the NET
>>> approach would work.
>>
>>
>> And, as suggested above, perhaps that the published compiled
>> examples won't have the problematic dependencies...
>
> There's another way round the uber jar. Requires Maven and Java
> runtime but not JDK.
>
> That is to provide the dependency POM I mentioned earlier.
>
> It will download the dependencies to the local Maven repo if
> necessary.
>
> I'll add a sample to JIRA so people can try it.
>
Do I understand correctly that, for the developers, it will amount to
modularizing the "pom.xml" without changing the behaviour (of maven),
and using the same "exec" incantation?
Users of CM that don't use maven, would be forced to install it, if
they want to run the examples.
[Anyways, we can leave the discussion about what and how to release
the examples when the time comes...]
Gilles
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by sebb <se...@gmail.com>.
On 8 January 2015 at 11:59, Gilles <gi...@harfang.homelinux.org> wrote:
> On Thu, 8 Jan 2015 01:20:20 +0000, sebb wrote:
>>
>> On 8 January 2015 at 00:25, Gilles <gi...@harfang.homelinux.org> wrote:
>>>
>>> On Wed, 7 Jan 2015 17:21:33 +0000, sebb wrote:
>>>>
>>>>
>>>> On 7 January 2015 at 17:12, Thomas Neidhart
>>>> <th...@gmail.com> wrote:
>>>>>
>>>>>
>>>>> On 01/07/2015 06:00 PM, sebb wrote:
>>>>>>
>>>>>>
>>>>>> On 7 January 2015 at 16:29, Thomas Neidhart
>>>>>> <th...@gmail.com>
>>>>>> wrote:
>>>>>>>
>>>>>>>
>>>>>>> On 01/07/2015 04:50 PM, sebb wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>> On 7 January 2015 at 13:59, Gilles <gi...@harfang.homelinux.org>
>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> [...]
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> I have pushed the change to the userguide. To execute the example
>>>>>>>>>> you do
>>>>>>>>>> the following:
>>>>>>>>>>
>>>>>>>>>> * go to commons-math folder, type mvn clean install
>>>>>>>>>> this step is only needed if your local maven repository does
>>>>>>>>>> not
>>>>>>>>>> yet
>>>>>>>>>> contain the latest commons-math snapshot
>>>>>>>>>> * go to userguide folder (src/userguide), type mvn clean package
>>>>>>>>>> * now you can run the examples like that:
>>>>>>>>>>
>>>>>>>>>> java -cp target/commons-math3-examples-uber-3.5-SNAPSHOT.jar
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Very nice.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Yes, however there is a caveat.
>>>>>>>> The uber jar must not be published, at least in its current form.
>>>>>>>> - it contains un-shaded classes that have different Maven coords (=>
>>>>>>>> jar hell)
>>>>>>>> - it does not have N&L files
>>>>>>>> - are the 3rd party jars AL compatible?
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> there is no intention to publish the uber jar.
>>>>>>
>>>>>>
>>>>>>
>>>>>> OK.
>>>>>>
>>>>>>>> There is another way to run the code without needing to generate the
>>>>>>>> jars:
>>>>>>>>
>>>>>>>> cd src/userguide
>>>>>>>>
>>>>>>>> mvn -q exec:java
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> -Dexec.mainClass=org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> nice, did not know this trick before.
>>>>>>>
>>>>>>>> This uses Maven to resolve the dependencies.
>>>>>>>>
>>>>>>>> Works very well for developer testing of examples.
>>>>>>>> However it is not so useful for end users as they would need Maven
>>>>>>>> and
>>>>>>>> the Math source.
>>>>>>>>
>>>>>>>> The NET jar method works well because there are no external
>>>>>>>> dependencies, and the example jar is created in the same directory
>>>>>>>> as
>>>>>>>> the core jar it depends on.
>>>>>>>>
>>>>>>>> The same approach would work for Math, but the user would have to
>>>>>>>> download the additional dependencies somehow.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> the approach with exec:java is good enough imho, as >90% of the users
>>>>>>> will have maven installed.
>>>
>>>
>>>
>>> Agreed.
>>> It's safe to assume that (see below for the proposed usage).
>>>
>>>>>>
>>>>>> But they won't necessarily have the Math source.
>>>>>>
>>>>>> On a whim I just tried creating a basic pom with only the
>>>>>> dependencies.
>>>>>> I added examples as another dependency.
>>>>>>
>>>>>> This works fine with exec:java from any directory provided only that
>>>>>> the examples have been installed (or can be found from a repo)
>>>>>>
>>>>>> A minor disadvantage of exec:java is one has to use properties for the
>>>>>> main class and arguments - the syntax is a bit awkward.
>>>
>>>
>>>
>>> I did not follow the details (e.g. what is "uber"?) but IMHO, one simple
>>
>>
>> The uber jar is a jar that contains the examples classes and all its
>> dependencies.
>>
>>> enough way is enough; the simpler the "pom.xml" the better (perhaps with
>>> a little README in the same directory).
>>
>>
>> The src/userguide/pom.xml compiles the examples and creates the uber jar.
>> The section that creates the uber jar could be dropped and it would
>> still be suitable for use with exec:java
>>
>>>>> the examples are also not published (yet), thus there is no way to run
>>>>> the examples without downloading the source distribution (or checkout
>>>>> the git repo).
>>>>
>>>>
>>>>
>>>> Yes, but the code we are discussing is for the next release.
>>>
>>>
>>>
>>> Not necessarily.
>>> The first step was necessarily to be able to compile and run them
>>> for ourselves.
>>
>>
>> OK
>>
>>>> I think it would make sense to include the compiled examples in the
>>>> release as a separate jar.
>>>
>>>
>>>
>>> IMO, the setup in the "src/userguide" can have at least two purposes
>>> that are more useful than publishing the compiled examples:
>>> 1. Generate reports (on various aspects of CM) to be integrated in
>>> "userguide" document. [For this, the build must run the code
>>> that generates the reports.]
>>> 2. Publish source code of working examples. [For this, the RM
>>> must of course ensure that the code is correct (i.e. compiles
>>> and runs as expected).]
>>>
>>> Providing compiled code is only useful if the examples are more
>>> than just toy problems, and provide readily useful functionalities:
>>> a library of real-world applications (in which the name "examples"
>>> won't be appropriate anymore). [We are not there yet (the idea of
>>> real-world examples was proposed quite some time ago but did not
>>> elicit any comment IIRC).]
>>
>>
>> By contrast the NET examples are all (or mostly) usable.
>>
>>> Points (1) and (2) would add to the resources which a newcomer
>>> might like to read to get acquainted with the contents of the
>>> library. The document should be readily available without a
>>> prospective user having to run anything.
>>>
>>
>> Well of course.
>
>
> So we need to set up a list of desirable reports...
> [One that comes to mind is a benchmark of FastMath.]
>
>> If the examples were extended to include useful utilities, then I
>> suspect you would find some people wanted to be able to run them
>> without needing to install Maven and a JDK.
>> In which case one way to do this is via a uber jar.
>> That would only require a Java runtime.
>
>
> I understand, but since there are no such utilities, better avoid
> potential license problems. I.e. let's first decide which examples
> are broadly, then publish only those when the time comes, and this
> in turn will require more fine-grained control of the build.
> So IMHO, it's better to remove the "uber" setup (if just so that
> we limit the things that might break, or that the thing that might
> break will be discovered sooner since we'd all use the same tool).
>
>>
>> If such examples did not need external dependencies, then the NET
>> approach would work.
>
>
> And, as suggested above, perhaps that the published compiled
> examples won't have the problematic dependencies...
There's another way round the uber jar. Requires Maven and Java
runtime but not JDK.
That is to provide the dependency POM I mentioned earlier.
It will download the dependencies to the local Maven repo if necessary.
I'll add a sample to JIRA so people can try it.
>
>
> 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] Maven profile for running the examples?
Posted by Gilles <gi...@harfang.homelinux.org>.
On Thu, 8 Jan 2015 01:20:20 +0000, sebb wrote:
> On 8 January 2015 at 00:25, Gilles <gi...@harfang.homelinux.org>
> wrote:
>> On Wed, 7 Jan 2015 17:21:33 +0000, sebb wrote:
>>>
>>> On 7 January 2015 at 17:12, Thomas Neidhart
>>> <th...@gmail.com> wrote:
>>>>
>>>> On 01/07/2015 06:00 PM, sebb wrote:
>>>>>
>>>>> On 7 January 2015 at 16:29, Thomas Neidhart
>>>>> <th...@gmail.com>
>>>>> wrote:
>>>>>>
>>>>>> On 01/07/2015 04:50 PM, sebb wrote:
>>>>>>>
>>>>>>> On 7 January 2015 at 13:59, Gilles
>>>>>>> <gi...@harfang.homelinux.org>
>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>> [...]
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> I have pushed the change to the userguide. To execute the
>>>>>>>>> example
>>>>>>>>> you do
>>>>>>>>> the following:
>>>>>>>>>
>>>>>>>>> * go to commons-math folder, type mvn clean install
>>>>>>>>> this step is only needed if your local maven repository
>>>>>>>>> does not
>>>>>>>>> yet
>>>>>>>>> contain the latest commons-math snapshot
>>>>>>>>> * go to userguide folder (src/userguide), type mvn clean
>>>>>>>>> package
>>>>>>>>> * now you can run the examples like that:
>>>>>>>>>
>>>>>>>>> java -cp target/commons-math3-examples-uber-3.5-SNAPSHOT.jar
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Very nice.
>>>>>>>
>>>>>>>
>>>>>>> Yes, however there is a caveat.
>>>>>>> The uber jar must not be published, at least in its current
>>>>>>> form.
>>>>>>> - it contains un-shaded classes that have different Maven
>>>>>>> coords (=>
>>>>>>> jar hell)
>>>>>>> - it does not have N&L files
>>>>>>> - are the 3rd party jars AL compatible?
>>>>>>
>>>>>>
>>>>>> there is no intention to publish the uber jar.
>>>>>
>>>>>
>>>>> OK.
>>>>>
>>>>>>> There is another way to run the code without needing to
>>>>>>> generate the
>>>>>>> jars:
>>>>>>>
>>>>>>> cd src/userguide
>>>>>>>
>>>>>>> mvn -q exec:java
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> -Dexec.mainClass=org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>>>
>>>>>>
>>>>>> nice, did not know this trick before.
>>>>>>
>>>>>>> This uses Maven to resolve the dependencies.
>>>>>>>
>>>>>>> Works very well for developer testing of examples.
>>>>>>> However it is not so useful for end users as they would need
>>>>>>> Maven and
>>>>>>> the Math source.
>>>>>>>
>>>>>>> The NET jar method works well because there are no external
>>>>>>> dependencies, and the example jar is created in the same
>>>>>>> directory as
>>>>>>> the core jar it depends on.
>>>>>>>
>>>>>>> The same approach would work for Math, but the user would have
>>>>>>> to
>>>>>>> download the additional dependencies somehow.
>>>>>>
>>>>>>
>>>>>> the approach with exec:java is good enough imho, as >90% of the
>>>>>> users
>>>>>> will have maven installed.
>>
>>
>> Agreed.
>> It's safe to assume that (see below for the proposed usage).
>>
>>>>>
>>>>> But they won't necessarily have the Math source.
>>>>>
>>>>> On a whim I just tried creating a basic pom with only the
>>>>> dependencies.
>>>>> I added examples as another dependency.
>>>>>
>>>>> This works fine with exec:java from any directory provided only
>>>>> that
>>>>> the examples have been installed (or can be found from a repo)
>>>>>
>>>>> A minor disadvantage of exec:java is one has to use properties
>>>>> for the
>>>>> main class and arguments - the syntax is a bit awkward.
>>
>>
>> I did not follow the details (e.g. what is "uber"?) but IMHO, one
>> simple
>
> The uber jar is a jar that contains the examples classes and all its
> dependencies.
>
>> enough way is enough; the simpler the "pom.xml" the better (perhaps
>> with
>> a little README in the same directory).
>
> The src/userguide/pom.xml compiles the examples and creates the uber
> jar.
> The section that creates the uber jar could be dropped and it would
> still be suitable for use with exec:java
>
>>>> the examples are also not published (yet), thus there is no way to
>>>> run
>>>> the examples without downloading the source distribution (or
>>>> checkout
>>>> the git repo).
>>>
>>>
>>> Yes, but the code we are discussing is for the next release.
>>
>>
>> Not necessarily.
>> The first step was necessarily to be able to compile and run them
>> for ourselves.
>
> OK
>
>>> I think it would make sense to include the compiled examples in the
>>> release as a separate jar.
>>
>>
>> IMO, the setup in the "src/userguide" can have at least two purposes
>> that are more useful than publishing the compiled examples:
>> 1. Generate reports (on various aspects of CM) to be integrated in
>> "userguide" document. [For this, the build must run the code
>> that generates the reports.]
>> 2. Publish source code of working examples. [For this, the RM
>> must of course ensure that the code is correct (i.e. compiles
>> and runs as expected).]
>>
>> Providing compiled code is only useful if the examples are more
>> than just toy problems, and provide readily useful functionalities:
>> a library of real-world applications (in which the name "examples"
>> won't be appropriate anymore). [We are not there yet (the idea of
>> real-world examples was proposed quite some time ago but did not
>> elicit any comment IIRC).]
>
> By contrast the NET examples are all (or mostly) usable.
>
>> Points (1) and (2) would add to the resources which a newcomer
>> might like to read to get acquainted with the contents of the
>> library. The document should be readily available without a
>> prospective user having to run anything.
>>
>
> Well of course.
So we need to set up a list of desirable reports...
[One that comes to mind is a benchmark of FastMath.]
> If the examples were extended to include useful utilities, then I
> suspect you would find some people wanted to be able to run them
> without needing to install Maven and a JDK.
> In which case one way to do this is via a uber jar.
> That would only require a Java runtime.
I understand, but since there are no such utilities, better avoid
potential license problems. I.e. let's first decide which examples
are broadly, then publish only those when the time comes, and this
in turn will require more fine-grained control of the build.
So IMHO, it's better to remove the "uber" setup (if just so that
we limit the things that might break, or that the thing that might
break will be discovered sooner since we'd all use the same tool).
>
> If such examples did not need external dependencies, then the NET
> approach would work.
And, as suggested above, perhaps that the published compiled
examples won't have the problematic dependencies...
Gilles
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by sebb <se...@gmail.com>.
On 8 January 2015 at 00:25, Gilles <gi...@harfang.homelinux.org> wrote:
> On Wed, 7 Jan 2015 17:21:33 +0000, sebb wrote:
>>
>> On 7 January 2015 at 17:12, Thomas Neidhart
>> <th...@gmail.com> wrote:
>>>
>>> On 01/07/2015 06:00 PM, sebb wrote:
>>>>
>>>> On 7 January 2015 at 16:29, Thomas Neidhart <th...@gmail.com>
>>>> wrote:
>>>>>
>>>>> On 01/07/2015 04:50 PM, sebb wrote:
>>>>>>
>>>>>> On 7 January 2015 at 13:59, Gilles <gi...@harfang.homelinux.org>
>>>>>> wrote:
>>>>>>>>>
>>>>>>>>> [...]
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> I have pushed the change to the userguide. To execute the example
>>>>>>>> you do
>>>>>>>> the following:
>>>>>>>>
>>>>>>>> * go to commons-math folder, type mvn clean install
>>>>>>>> this step is only needed if your local maven repository does not
>>>>>>>> yet
>>>>>>>> contain the latest commons-math snapshot
>>>>>>>> * go to userguide folder (src/userguide), type mvn clean package
>>>>>>>> * now you can run the examples like that:
>>>>>>>>
>>>>>>>> java -cp target/commons-math3-examples-uber-3.5-SNAPSHOT.jar
>>>>>>>>
>>>>>>>> org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Very nice.
>>>>>>
>>>>>>
>>>>>> Yes, however there is a caveat.
>>>>>> The uber jar must not be published, at least in its current form.
>>>>>> - it contains un-shaded classes that have different Maven coords (=>
>>>>>> jar hell)
>>>>>> - it does not have N&L files
>>>>>> - are the 3rd party jars AL compatible?
>>>>>
>>>>>
>>>>> there is no intention to publish the uber jar.
>>>>
>>>>
>>>> OK.
>>>>
>>>>>> There is another way to run the code without needing to generate the
>>>>>> jars:
>>>>>>
>>>>>> cd src/userguide
>>>>>>
>>>>>> mvn -q exec:java
>>>>>>
>>>>>>
>>>>>> -Dexec.mainClass=org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>>
>>>>>
>>>>> nice, did not know this trick before.
>>>>>
>>>>>> This uses Maven to resolve the dependencies.
>>>>>>
>>>>>> Works very well for developer testing of examples.
>>>>>> However it is not so useful for end users as they would need Maven and
>>>>>> the Math source.
>>>>>>
>>>>>> The NET jar method works well because there are no external
>>>>>> dependencies, and the example jar is created in the same directory as
>>>>>> the core jar it depends on.
>>>>>>
>>>>>> The same approach would work for Math, but the user would have to
>>>>>> download the additional dependencies somehow.
>>>>>
>>>>>
>>>>> the approach with exec:java is good enough imho, as >90% of the users
>>>>> will have maven installed.
>
>
> Agreed.
> It's safe to assume that (see below for the proposed usage).
>
>>>>
>>>> But they won't necessarily have the Math source.
>>>>
>>>> On a whim I just tried creating a basic pom with only the dependencies.
>>>> I added examples as another dependency.
>>>>
>>>> This works fine with exec:java from any directory provided only that
>>>> the examples have been installed (or can be found from a repo)
>>>>
>>>> A minor disadvantage of exec:java is one has to use properties for the
>>>> main class and arguments - the syntax is a bit awkward.
>
>
> I did not follow the details (e.g. what is "uber"?) but IMHO, one simple
The uber jar is a jar that contains the examples classes and all its
dependencies.
> enough way is enough; the simpler the "pom.xml" the better (perhaps with
> a little README in the same directory).
The src/userguide/pom.xml compiles the examples and creates the uber jar.
The section that creates the uber jar could be dropped and it would
still be suitable for use with exec:java
>>> the examples are also not published (yet), thus there is no way to run
>>> the examples without downloading the source distribution (or checkout
>>> the git repo).
>>
>>
>> Yes, but the code we are discussing is for the next release.
>
>
> Not necessarily.
> The first step was necessarily to be able to compile and run them
> for ourselves.
OK
>> I think it would make sense to include the compiled examples in the
>> release as a separate jar.
>
>
> IMO, the setup in the "src/userguide" can have at least two purposes
> that are more useful than publishing the compiled examples:
> 1. Generate reports (on various aspects of CM) to be integrated in
> "userguide" document. [For this, the build must run the code
> that generates the reports.]
> 2. Publish source code of working examples. [For this, the RM
> must of course ensure that the code is correct (i.e. compiles
> and runs as expected).]
>
> Providing compiled code is only useful if the examples are more
> than just toy problems, and provide readily useful functionalities:
> a library of real-world applications (in which the name "examples"
> won't be appropriate anymore). [We are not there yet (the idea of
> real-world examples was proposed quite some time ago but did not
> elicit any comment IIRC).]
By contrast the NET examples are all (or mostly) usable.
> Points (1) and (2) would add to the resources which a newcomer
> might like to read to get acquainted with the contents of the
> library. The document should be readily available without a
> prospective user having to run anything.
>
Well of course.
If the examples were extended to include useful utilities, then I
suspect you would find some people wanted to be able to run them
without needing to install Maven and a JDK.
In which case one way to do this is via a uber jar.
That would only require a Java runtime.
If such examples did not need external dependencies, then the NET
approach would work.
> 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] Maven profile for running the examples?
Posted by Gilles <gi...@harfang.homelinux.org>.
On Wed, 7 Jan 2015 17:21:33 +0000, sebb wrote:
> On 7 January 2015 at 17:12, Thomas Neidhart
> <th...@gmail.com> wrote:
>> On 01/07/2015 06:00 PM, sebb wrote:
>>> On 7 January 2015 at 16:29, Thomas Neidhart
>>> <th...@gmail.com> wrote:
>>>> On 01/07/2015 04:50 PM, sebb wrote:
>>>>> On 7 January 2015 at 13:59, Gilles <gi...@harfang.homelinux.org>
>>>>> wrote:
>>>>>>>> [...]
>>>>>>>
>>>>>>>
>>>>>>> I have pushed the change to the userguide. To execute the
>>>>>>> example you do
>>>>>>> the following:
>>>>>>>
>>>>>>> * go to commons-math folder, type mvn clean install
>>>>>>> this step is only needed if your local maven repository does
>>>>>>> not yet
>>>>>>> contain the latest commons-math snapshot
>>>>>>> * go to userguide folder (src/userguide), type mvn clean
>>>>>>> package
>>>>>>> * now you can run the examples like that:
>>>>>>>
>>>>>>> java -cp target/commons-math3-examples-uber-3.5-SNAPSHOT.jar
>>>>>>>
>>>>>>> org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>>>
>>>>>>
>>>>>> Very nice.
>>>>>
>>>>> Yes, however there is a caveat.
>>>>> The uber jar must not be published, at least in its current form.
>>>>> - it contains un-shaded classes that have different Maven coords
>>>>> (=> jar hell)
>>>>> - it does not have N&L files
>>>>> - are the 3rd party jars AL compatible?
>>>>
>>>> there is no intention to publish the uber jar.
>>>
>>> OK.
>>>
>>>>> There is another way to run the code without needing to generate
>>>>> the jars:
>>>>>
>>>>> cd src/userguide
>>>>>
>>>>> mvn -q exec:java
>>>>>
>>>>> -Dexec.mainClass=org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>
>>>> nice, did not know this trick before.
>>>>
>>>>> This uses Maven to resolve the dependencies.
>>>>>
>>>>> Works very well for developer testing of examples.
>>>>> However it is not so useful for end users as they would need
>>>>> Maven and
>>>>> the Math source.
>>>>>
>>>>> The NET jar method works well because there are no external
>>>>> dependencies, and the example jar is created in the same
>>>>> directory as
>>>>> the core jar it depends on.
>>>>>
>>>>> The same approach would work for Math, but the user would have to
>>>>> download the additional dependencies somehow.
>>>>
>>>> the approach with exec:java is good enough imho, as >90% of the
>>>> users
>>>> will have maven installed.
Agreed.
It's safe to assume that (see below for the proposed usage).
>>>
>>> But they won't necessarily have the Math source.
>>>
>>> On a whim I just tried creating a basic pom with only the
>>> dependencies.
>>> I added examples as another dependency.
>>>
>>> This works fine with exec:java from any directory provided only
>>> that
>>> the examples have been installed (or can be found from a repo)
>>>
>>> A minor disadvantage of exec:java is one has to use properties for
>>> the
>>> main class and arguments - the syntax is a bit awkward.
I did not follow the details (e.g. what is "uber"?) but IMHO, one
simple
enough way is enough; the simpler the "pom.xml" the better (perhaps
with
a little README in the same directory).
>> the examples are also not published (yet), thus there is no way to
>> run
>> the examples without downloading the source distribution (or
>> checkout
>> the git repo).
>
> Yes, but the code we are discussing is for the next release.
Not necessarily.
The first step was necessarily to be able to compile and run them
for ourselves.
> I think it would make sense to include the compiled examples in the
> release as a separate jar.
IMO, the setup in the "src/userguide" can have at least two purposes
that are more useful than publishing the compiled examples:
1. Generate reports (on various aspects of CM) to be integrated in
"userguide" document. [For this, the build must run the code
that generates the reports.]
2. Publish source code of working examples. [For this, the RM
must of course ensure that the code is correct (i.e. compiles
and runs as expected).]
Providing compiled code is only useful if the examples are more
than just toy problems, and provide readily useful functionalities:
a library of real-world applications (in which the name "examples"
won't be appropriate anymore). [We are not there yet (the idea of
real-world examples was proposed quite some time ago but did not
elicit any comment IIRC).]
Points (1) and (2) would add to the resources which a newcomer
might like to read to get acquainted with the contents of the
library. The document should be readily available without a
prospective user having to run anything.
Gilles
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by sebb <se...@gmail.com>.
On 7 January 2015 at 17:12, Thomas Neidhart <th...@gmail.com> wrote:
> On 01/07/2015 06:00 PM, sebb wrote:
>> On 7 January 2015 at 16:29, Thomas Neidhart <th...@gmail.com> wrote:
>>> On 01/07/2015 04:50 PM, sebb wrote:
>>>> On 7 January 2015 at 13:59, Gilles <gi...@harfang.homelinux.org> wrote:
>>>>>>> [...]
>>>>>>
>>>>>>
>>>>>> I have pushed the change to the userguide. To execute the example you do
>>>>>> the following:
>>>>>>
>>>>>> * go to commons-math folder, type mvn clean install
>>>>>> this step is only needed if your local maven repository does not yet
>>>>>> contain the latest commons-math snapshot
>>>>>> * go to userguide folder (src/userguide), type mvn clean package
>>>>>> * now you can run the examples like that:
>>>>>>
>>>>>> java -cp target/commons-math3-examples-uber-3.5-SNAPSHOT.jar
>>>>>> org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>>
>>>>>
>>>>> Very nice.
>>>>
>>>> Yes, however there is a caveat.
>>>> The uber jar must not be published, at least in its current form.
>>>> - it contains un-shaded classes that have different Maven coords (=> jar hell)
>>>> - it does not have N&L files
>>>> - are the 3rd party jars AL compatible?
>>>
>>> there is no intention to publish the uber jar.
>>
>> OK.
>>
>>>> There is another way to run the code without needing to generate the jars:
>>>>
>>>> cd src/userguide
>>>>
>>>> mvn -q exec:java
>>>> -Dexec.mainClass=org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>
>>> nice, did not know this trick before.
>>>
>>>> This uses Maven to resolve the dependencies.
>>>>
>>>> Works very well for developer testing of examples.
>>>> However it is not so useful for end users as they would need Maven and
>>>> the Math source.
>>>>
>>>> The NET jar method works well because there are no external
>>>> dependencies, and the example jar is created in the same directory as
>>>> the core jar it depends on.
>>>>
>>>> The same approach would work for Math, but the user would have to
>>>> download the additional dependencies somehow.
>>>
>>> the approach with exec:java is good enough imho, as >90% of the users
>>> will have maven installed.
>>
>> But they won't necessarily have the Math source.
>>
>> On a whim I just tried creating a basic pom with only the dependencies.
>> I added examples as another dependency.
>>
>> This works fine with exec:java from any directory provided only that
>> the examples have been installed (or can be found from a repo)
>>
>> A minor disadvantage of exec:java is one has to use properties for the
>> main class and arguments - the syntax is a bit awkward.
>
> the examples are also not published (yet), thus there is no way to run
> the examples without downloading the source distribution (or checkout
> the git repo).
Yes, but the code we are discussing is for the next release.
I think it would make sense to include the compiled examples in the
release as a separate jar.
> Thomas
>
> ---------------------------------------------------------------------
> 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] Maven profile for running the examples?
Posted by Thomas Neidhart <th...@gmail.com>.
On 01/07/2015 06:00 PM, sebb wrote:
> On 7 January 2015 at 16:29, Thomas Neidhart <th...@gmail.com> wrote:
>> On 01/07/2015 04:50 PM, sebb wrote:
>>> On 7 January 2015 at 13:59, Gilles <gi...@harfang.homelinux.org> wrote:
>>>>>> [...]
>>>>>
>>>>>
>>>>> I have pushed the change to the userguide. To execute the example you do
>>>>> the following:
>>>>>
>>>>> * go to commons-math folder, type mvn clean install
>>>>> this step is only needed if your local maven repository does not yet
>>>>> contain the latest commons-math snapshot
>>>>> * go to userguide folder (src/userguide), type mvn clean package
>>>>> * now you can run the examples like that:
>>>>>
>>>>> java -cp target/commons-math3-examples-uber-3.5-SNAPSHOT.jar
>>>>> org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>>
>>>>
>>>> Very nice.
>>>
>>> Yes, however there is a caveat.
>>> The uber jar must not be published, at least in its current form.
>>> - it contains un-shaded classes that have different Maven coords (=> jar hell)
>>> - it does not have N&L files
>>> - are the 3rd party jars AL compatible?
>>
>> there is no intention to publish the uber jar.
>
> OK.
>
>>> There is another way to run the code without needing to generate the jars:
>>>
>>> cd src/userguide
>>>
>>> mvn -q exec:java
>>> -Dexec.mainClass=org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>
>> nice, did not know this trick before.
>>
>>> This uses Maven to resolve the dependencies.
>>>
>>> Works very well for developer testing of examples.
>>> However it is not so useful for end users as they would need Maven and
>>> the Math source.
>>>
>>> The NET jar method works well because there are no external
>>> dependencies, and the example jar is created in the same directory as
>>> the core jar it depends on.
>>>
>>> The same approach would work for Math, but the user would have to
>>> download the additional dependencies somehow.
>>
>> the approach with exec:java is good enough imho, as >90% of the users
>> will have maven installed.
>
> But they won't necessarily have the Math source.
>
> On a whim I just tried creating a basic pom with only the dependencies.
> I added examples as another dependency.
>
> This works fine with exec:java from any directory provided only that
> the examples have been installed (or can be found from a repo)
>
> A minor disadvantage of exec:java is one has to use properties for the
> main class and arguments - the syntax is a bit awkward.
the examples are also not published (yet), thus there is no way to run
the examples without downloading the source distribution (or checkout
the git repo).
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by sebb <se...@gmail.com>.
On 7 January 2015 at 16:29, Thomas Neidhart <th...@gmail.com> wrote:
> On 01/07/2015 04:50 PM, sebb wrote:
>> On 7 January 2015 at 13:59, Gilles <gi...@harfang.homelinux.org> wrote:
>>>>> [...]
>>>>
>>>>
>>>> I have pushed the change to the userguide. To execute the example you do
>>>> the following:
>>>>
>>>> * go to commons-math folder, type mvn clean install
>>>> this step is only needed if your local maven repository does not yet
>>>> contain the latest commons-math snapshot
>>>> * go to userguide folder (src/userguide), type mvn clean package
>>>> * now you can run the examples like that:
>>>>
>>>> java -cp target/commons-math3-examples-uber-3.5-SNAPSHOT.jar
>>>> org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>>
>>>
>>> Very nice.
>>
>> Yes, however there is a caveat.
>> The uber jar must not be published, at least in its current form.
>> - it contains un-shaded classes that have different Maven coords (=> jar hell)
>> - it does not have N&L files
>> - are the 3rd party jars AL compatible?
>
> there is no intention to publish the uber jar.
OK.
>> There is another way to run the code without needing to generate the jars:
>>
>> cd src/userguide
>>
>> mvn -q exec:java
>> -Dexec.mainClass=org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>
> nice, did not know this trick before.
>
>> This uses Maven to resolve the dependencies.
>>
>> Works very well for developer testing of examples.
>> However it is not so useful for end users as they would need Maven and
>> the Math source.
>>
>> The NET jar method works well because there are no external
>> dependencies, and the example jar is created in the same directory as
>> the core jar it depends on.
>>
>> The same approach would work for Math, but the user would have to
>> download the additional dependencies somehow.
>
> the approach with exec:java is good enough imho, as >90% of the users
> will have maven installed.
But they won't necessarily have the Math source.
On a whim I just tried creating a basic pom with only the dependencies.
I added examples as another dependency.
This works fine with exec:java from any directory provided only that
the examples have been installed (or can be found from a repo)
A minor disadvantage of exec:java is one has to use properties for the
main class and arguments - the syntax is a bit awkward.
> Thomas
>
> ---------------------------------------------------------------------
> 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] Maven profile for running the examples?
Posted by Thomas Neidhart <th...@gmail.com>.
On 01/07/2015 04:50 PM, sebb wrote:
> On 7 January 2015 at 13:59, Gilles <gi...@harfang.homelinux.org> wrote:
>>>> [...]
>>>
>>>
>>> I have pushed the change to the userguide. To execute the example you do
>>> the following:
>>>
>>> * go to commons-math folder, type mvn clean install
>>> this step is only needed if your local maven repository does not yet
>>> contain the latest commons-math snapshot
>>> * go to userguide folder (src/userguide), type mvn clean package
>>> * now you can run the examples like that:
>>>
>>> java -cp target/commons-math3-examples-uber-3.5-SNAPSHOT.jar
>>> org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>>
>>
>> Very nice.
>
> Yes, however there is a caveat.
> The uber jar must not be published, at least in its current form.
> - it contains un-shaded classes that have different Maven coords (=> jar hell)
> - it does not have N&L files
> - are the 3rd party jars AL compatible?
there is no intention to publish the uber jar.
> There is another way to run the code without needing to generate the jars:
>
> cd src/userguide
>
> mvn -q exec:java
> -Dexec.mainClass=org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
nice, did not know this trick before.
> This uses Maven to resolve the dependencies.
>
> Works very well for developer testing of examples.
> However it is not so useful for end users as they would need Maven and
> the Math source.
>
> The NET jar method works well because there are no external
> dependencies, and the example jar is created in the same directory as
> the core jar it depends on.
>
> The same approach would work for Math, but the user would have to
> download the additional dependencies somehow.
the approach with exec:java is good enough imho, as >90% of the users
will have maven installed.
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by sebb <se...@gmail.com>.
On 7 January 2015 at 13:59, Gilles <gi...@harfang.homelinux.org> wrote:
>>> [...]
>>
>>
>> I have pushed the change to the userguide. To execute the example you do
>> the following:
>>
>> * go to commons-math folder, type mvn clean install
>> this step is only needed if your local maven repository does not yet
>> contain the latest commons-math snapshot
>> * go to userguide folder (src/userguide), type mvn clean package
>> * now you can run the examples like that:
>>
>> java -cp target/commons-math3-examples-uber-3.5-SNAPSHOT.jar
>> org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
>
>
> Very nice.
Yes, however there is a caveat.
The uber jar must not be published, at least in its current form.
- it contains un-shaded classes that have different Maven coords (=> jar hell)
- it does not have N&L files
- are the 3rd party jars AL compatible?
There is another way to run the code without needing to generate the jars:
cd src/userguide
mvn -q exec:java
-Dexec.mainClass=org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
This uses Maven to resolve the dependencies.
Works very well for developer testing of examples.
However it is not so useful for end users as they would need Maven and
the Math source.
The NET jar method works well because there are no external
dependencies, and the example jar is created in the same directory as
the core jar it depends on.
The same approach would work for Math, but the user would have to
download the additional dependencies somehow.
> 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] Maven profile for running the examples?
Posted by Gilles <gi...@harfang.homelinux.org>.
>> [...]
>
> I have pushed the change to the userguide. To execute the example you
> do
> the following:
>
> * go to commons-math folder, type mvn clean install
> this step is only needed if your local maven repository does not
> yet
> contain the latest commons-math snapshot
> * go to userguide folder (src/userguide), type mvn clean package
> * now you can run the examples like that:
>
> java -cp target/commons-math3-examples-uber-3.5-SNAPSHOT.jar
> org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
Very nice.
Thanks,
Gilles
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by Thomas Neidhart <th...@gmail.com>.
On 01/06/2015 10:08 PM, Gilles wrote:
> On Tue, 06 Jan 2015 20:41:26 +0100, Thomas Neidhart wrote:
>> On 01/06/2015 07:28 PM, Gilles wrote:
>>> On Tue, 06 Jan 2015 17:49:35 +0100, Thomas Neidhart wrote:
>>>> On 01/06/2015 12:58 PM, Gilles 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 <gi...@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).]
>>>>> IIUC, Sebb proposed that the source code be moved solely for
>>>>> the purpose that maven would compile it with the default config.
>>>>
>>>> I was not talking about packaging.
>>>>
>>>>> IIUC, with Bernd's proposal, this move is thus not necessary.
>>>>
>>>> Neither will work, unless you add the relevant dependencies to the main
>>>> pom.xml which we certainly do not want.
>>>>
>>>> I just wanted to point this out before anybody is doing a change.
>>>
>>> As long as the CM library have no dependencies, is it a problem
>>> that non-packaged (or separately packaged) code does have dependencies?
>>>
>>> Or is it that it will be more complicated to ensure that there is no
>>> such dependencies for CM itself once the "pom" file refers to them?
>>>
>>> Or is it that really the "pom" file is not allowed to contain such
>>> references?
>>
>> The userguide has dependencies and in order to compile it as part of the
>> "normal" commons-math codebase, e.g. using mvn compile, these
>> dependencies have to be specified in the pom.xml. Afaik the only way to
>> exclude these dependencies would be to use the scope "provided", but it
>> is certainly a solution I would not suggest as it wrongly implies that
>> commons-math has a reference to them, while in fact it hasn't, only the
>> userguide part.
>>
>> Normally, you solve this situations by using a multi-module setup, as
>> said below.
>>
>>>> The best option would certainly be a multi-module project, with the
>>>> examples / userguide a separate module, but this would require some
>>>> changes and a few months ago when we started doing this there was no
>>>> consensus about it.
>>>>
>>>>> 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.
>>>>
>>>> Right now, you can only run them directly in eclipse by adding a
>>>> project
>>>> for them, but we could easily do the same as NET does.
>>>
>>> The original request is: How do we run the examples?
>>> To be more specific: how to run a specific example from the command
>>> line?
>>>
>>> I'm perfectly fine with only modifying the "pom.xml" located in
>>> src/userguide
>>>
>>> Would that work?
>>> Do you readily know what needs to be added?
>>
>> yes, but as sebb suggested, the easiest solution is certainly as follows:
>>
>> * create a commons-math-userguide.jar package using mvn package
>
> Thus, copying the relevant from the "main" pom (that creates the
> "tools" JAR) over to the pom in the userguide directory?
>
>> * copy this jar together with necessary dependencies (xchart,
>> commons-math) into a directory
>> * run java -cp . ExampleXXX parameters
>
> That would be good enough, I guess.
>
>> The whole thing could be further simplified by creating a userguide jar
>> that already contains all dependencies in one jar.
>>
>> There could even be scripts in the userguide that can be executed by a
>> user for this purpose.
>
> That's what I meant, if "maven" can be considered as a script.
I have pushed the change to the userguide. To execute the example you do
the following:
* go to commons-math folder, type mvn clean install
this step is only needed if your local maven repository does not yet
contain the latest commons-math snapshot
* go to userguide folder (src/userguide), type mvn clean package
* now you can run the examples like that:
java -cp target/commons-math3-examples-uber-3.5-SNAPSHOT.jar
org.apache.commons.math3.userguide.LowDiscrepancyGeneratorComparison
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by Gilles <gi...@harfang.homelinux.org>.
On Tue, 06 Jan 2015 20:41:26 +0100, Thomas Neidhart wrote:
> On 01/06/2015 07:28 PM, Gilles wrote:
>> On Tue, 06 Jan 2015 17:49:35 +0100, Thomas Neidhart wrote:
>>> On 01/06/2015 12:58 PM, Gilles 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 <gi...@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).]
>>>> IIUC, Sebb proposed that the source code be moved solely for
>>>> the purpose that maven would compile it with the default config.
>>>
>>> I was not talking about packaging.
>>>
>>>> IIUC, with Bernd's proposal, this move is thus not necessary.
>>>
>>> Neither will work, unless you add the relevant dependencies to the
>>> main
>>> pom.xml which we certainly do not want.
>>>
>>> I just wanted to point this out before anybody is doing a change.
>>
>> As long as the CM library have no dependencies, is it a problem
>> that non-packaged (or separately packaged) code does have
>> dependencies?
>>
>> Or is it that it will be more complicated to ensure that there is no
>> such dependencies for CM itself once the "pom" file refers to them?
>>
>> Or is it that really the "pom" file is not allowed to contain such
>> references?
>
> The userguide has dependencies and in order to compile it as part of
> the
> "normal" commons-math codebase, e.g. using mvn compile, these
> dependencies have to be specified in the pom.xml. Afaik the only way
> to
> exclude these dependencies would be to use the scope "provided", but
> it
> is certainly a solution I would not suggest as it wrongly implies
> that
> commons-math has a reference to them, while in fact it hasn't, only
> the
> userguide part.
>
> Normally, you solve this situations by using a multi-module setup, as
> said below.
>
>>> The best option would certainly be a multi-module project, with the
>>> examples / userguide a separate module, but this would require some
>>> changes and a few months ago when we started doing this there was
>>> no
>>> consensus about it.
>>>
>>>> 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.
>>>
>>> Right now, you can only run them directly in eclipse by adding a
>>> project
>>> for them, but we could easily do the same as NET does.
>>
>> The original request is: How do we run the examples?
>> To be more specific: how to run a specific example from the command
>> line?
>>
>> I'm perfectly fine with only modifying the "pom.xml" located in
>> src/userguide
>>
>> Would that work?
>> Do you readily know what needs to be added?
>
> yes, but as sebb suggested, the easiest solution is certainly as
> follows:
>
> * create a commons-math-userguide.jar package using mvn package
Thus, copying the relevant from the "main" pom (that creates the
"tools" JAR) over to the pom in the userguide directory?
> * copy this jar together with necessary dependencies (xchart,
> commons-math) into a directory
> * run java -cp . ExampleXXX parameters
That would be good enough, I guess.
> The whole thing could be further simplified by creating a userguide
> jar
> that already contains all dependencies in one jar.
>
> There could even be scripts in the userguide that can be executed by
> a
> user for this purpose.
That's what I meant, if "maven" can be considered as a script.
Gilles
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by Thomas Neidhart <th...@gmail.com>.
On 01/06/2015 07:28 PM, Gilles wrote:
> On Tue, 06 Jan 2015 17:49:35 +0100, Thomas Neidhart wrote:
>> On 01/06/2015 12:58 PM, Gilles 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 <gi...@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).]
>>> IIUC, Sebb proposed that the source code be moved solely for
>>> the purpose that maven would compile it with the default config.
>>
>> I was not talking about packaging.
>>
>>> IIUC, with Bernd's proposal, this move is thus not necessary.
>>
>> Neither will work, unless you add the relevant dependencies to the main
>> pom.xml which we certainly do not want.
>>
>> I just wanted to point this out before anybody is doing a change.
>
> As long as the CM library have no dependencies, is it a problem
> that non-packaged (or separately packaged) code does have dependencies?
>
> Or is it that it will be more complicated to ensure that there is no
> such dependencies for CM itself once the "pom" file refers to them?
>
> Or is it that really the "pom" file is not allowed to contain such
> references?
The userguide has dependencies and in order to compile it as part of the
"normal" commons-math codebase, e.g. using mvn compile, these
dependencies have to be specified in the pom.xml. Afaik the only way to
exclude these dependencies would be to use the scope "provided", but it
is certainly a solution I would not suggest as it wrongly implies that
commons-math has a reference to them, while in fact it hasn't, only the
userguide part.
Normally, you solve this situations by using a multi-module setup, as
said below.
>> The best option would certainly be a multi-module project, with the
>> examples / userguide a separate module, but this would require some
>> changes and a few months ago when we started doing this there was no
>> consensus about it.
>>
>>> 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.
>>
>> Right now, you can only run them directly in eclipse by adding a project
>> for them, but we could easily do the same as NET does.
>
> The original request is: How do we run the examples?
> To be more specific: how to run a specific example from the command line?
>
> I'm perfectly fine with only modifying the "pom.xml" located in
> src/userguide
>
> Would that work?
> Do you readily know what needs to be added?
yes, but as sebb suggested, the easiest solution is certainly as follows:
* create a commons-math-userguide.jar package using mvn package
* copy this jar together with necessary dependencies (xchart,
commons-math) into a directory
* run java -cp . ExampleXXX parameters
The whole thing could be further simplified by creating a userguide jar
that already contains all dependencies in one jar.
There could even be scripts in the userguide that can be executed by a
user for this purpose.
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by Gilles <gi...@harfang.homelinux.org>.
On Tue, 06 Jan 2015 17:49:35 +0100, Thomas Neidhart wrote:
> On 01/06/2015 12:58 PM, Gilles 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 <gi...@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).]
>> IIUC, Sebb proposed that the source code be moved solely for
>> the purpose that maven would compile it with the default config.
>
> I was not talking about packaging.
>
>> IIUC, with Bernd's proposal, this move is thus not necessary.
>
> Neither will work, unless you add the relevant dependencies to the
> main
> pom.xml which we certainly do not want.
>
> I just wanted to point this out before anybody is doing a change.
As long as the CM library have no dependencies, is it a problem
that non-packaged (or separately packaged) code does have dependencies?
Or is it that it will be more complicated to ensure that there is no
such dependencies for CM itself once the "pom" file refers to them?
Or is it that really the "pom" file is not allowed to contain such
references?
> The best option would certainly be a multi-module project, with the
> examples / userguide a separate module, but this would require some
> changes and a few months ago when we started doing this there was no
> consensus about it.
>
>> 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.
>
> Right now, you can only run them directly in eclipse by adding a
> project
> for them, but we could easily do the same as NET does.
The original request is: How do we run the examples?
To be more specific: how to run a specific example from the command
line?
I'm perfectly fine with only modifying the "pom.xml" located in
src/userguide
Would that work?
Do you readily know what needs to be added?
Gilles
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by Thomas Neidhart <th...@gmail.com>.
On 01/06/2015 12:58 PM, Gilles 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 <gi...@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).]
> IIUC, Sebb proposed that the source code be moved solely for
> the purpose that maven would compile it with the default config.
I was not talking about packaging.
> IIUC, with Bernd's proposal, this move is thus not necessary.
Neither will work, unless you add the relevant dependencies to the main
pom.xml which we certainly do not want.
I just wanted to point this out before anybody is doing a change.
>> 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 best option would certainly be a multi-module project, with the
examples / userguide a separate module, but this would require some
changes and a few months ago when we started doing this there was no
consensus about it.
> 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.
Right now, you can only run them directly in eclipse by adding a project
for them, but we could easily do the same as NET does.
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by Gilles <gi...@harfang.homelinux.org>.
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 <gi...@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).]
IIUC, Sebb proposed that the source code be moved solely for
the purpose that maven would compile it with the default config.
IIUC, with Bernd's proposal, this move is thus not necessary.
> 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.
Gilles
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by Thomas Neidhart <th...@gmail.com>.
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 <gi...@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.
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).
Thomas
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by Gilles <gi...@harfang.homelinux.org>.
On Mon, 5 Jan 2015 23:48:43 +0100, Bernd Eckenfels wrote:
> Am Mon, 05 Jan 2015 23:35:49 +0100
> schrieb Gilles <gi...@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.
Regards,
Gilles
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by Bernd Eckenfels <ec...@zusammenkunft.net>.
Am Mon, 05 Jan 2015 23:35:49 +0100
schrieb Gilles <gi...@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.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by Gilles <gi...@harfang.homelinux.org>.
On Mon, 05 Jan 2015 20:43:18 +0100, Luc Maisonobe wrote:
> Le 05/01/2015 18:41, Gilles a écrit :
>> On Sun, 4 Jan 2015 20:31:30 +0000, sebb wrote:
>>> Did you see my mail from earlier today titled as below ?
>>>
>>> Compiling and running examples
>>>
>>> This explains how Commons NET examples are built and used.
>>
>> Copy-pasting Sebb's proposal from the other thread:
>>
>>> [Examples] can be invoked using java -jar
>>> commons-net-examples.jar
>>> ExampleName parameters.
>>> This assumes that the user has put the examples and main net
>>> jars
>>> in the same directory.
>>
>> Would everyone agree to move the "userguide" code into the "main"
>> directory?
>> [Of course, this would imply that we need to modify the "pom.xml"
>> in order to exclude the "userguide" code from the CM library JAR.]
>>
>> Please let me know if this solution is fine, so that I can modify
>> the CM's "pom.xml" file and move the code accordingly.
>
> No problem for me, as long as maven can find the docs.
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"
Gilles
>
> best regards,
> Luc
>
>>
>>
>> Thanks,
>> Gilles
>>
>>> On 4 January 2015 at 18:21, Gilles <gi...@harfang.homelinux.org>
>>> wrote:
>>>> Hi.
>>>>
>>>> In the "src/userguide/java" directory, there are a few
>>>> self-contained usage examples.
>>>>
>>>> I think that we should have some way to
>>>> 1. automatically compile its content (so that we can ensure that
>>>> the
>>>> source tree does not contain any non-compilable stuff) and
>>>> 2. run selected classes (so that users easily see CM code at work)
>>>>
>>>> It looks like it should not be too difficult (for an experienced
>>>> maven user, which I'm not) to create a profile for doing just
>>>> that.
>>>> [I've seen there is an "exec" plugin that could do (2), but I
>>>> didn't find where, in the "pom.xml", one can specify an alternate
>>>> directory for indicating which sources to compile.]
>>>>
>>>>
>>>> Thanks for any hint,
>>>> Gilles
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org
Re: [Math] Maven profile for running the examples?
Posted by Luc Maisonobe <lu...@spaceroots.org>.
Le 05/01/2015 18:41, Gilles a écrit :
> On Sun, 4 Jan 2015 20:31:30 +0000, sebb wrote:
>> Did you see my mail from earlier today titled as below ?
>>
>> Compiling and running examples
>>
>> This explains how Commons NET examples are built and used.
>
> Copy-pasting Sebb's proposal from the other thread:
>
>> [Examples] can be invoked using java -jar commons-net-examples.jar
>> ExampleName parameters.
>> This assumes that the user has put the examples and main net jars
>> in the same directory.
>
> Would everyone agree to move the "userguide" code into the "main"
> directory?
> [Of course, this would imply that we need to modify the "pom.xml"
> in order to exclude the "userguide" code from the CM library JAR.]
>
> Please let me know if this solution is fine, so that I can modify
> the CM's "pom.xml" file and move the code accordingly.
No problem for me, as long as maven can find the docs.
best regards,
Luc
>
>
> Thanks,
> Gilles
>
>> On 4 January 2015 at 18:21, Gilles <gi...@harfang.homelinux.org> wrote:
>>> Hi.
>>>
>>> In the "src/userguide/java" directory, there are a few
>>> self-contained usage examples.
>>>
>>> I think that we should have some way to
>>> 1. automatically compile its content (so that we can ensure that the
>>> source tree does not contain any non-compilable stuff) and
>>> 2. run selected classes (so that users easily see CM code at work)
>>>
>>> It looks like it should not be too difficult (for an experienced
>>> maven user, which I'm not) to create a profile for doing just that.
>>> [I've seen there is an "exec" plugin that could do (2), but I
>>> didn't find where, in the "pom.xml", one can specify an alternate
>>> directory for indicating which sources to compile.]
>>>
>>>
>>> Thanks for any hint,
>>> Gilles
>
>> 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] Maven profile for running the examples?
Posted by Gilles <gi...@harfang.homelinux.org>.
On Sun, 4 Jan 2015 20:31:30 +0000, sebb wrote:
> Did you see my mail from earlier today titled as below ?
>
> Compiling and running examples
>
> This explains how Commons NET examples are built and used.
Copy-pasting Sebb's proposal from the other thread:
> [Examples] can be invoked using java -jar commons-net-examples.jar
> ExampleName parameters.
> This assumes that the user has put the examples and main net jars
> in the same directory.
Would everyone agree to move the "userguide" code into the "main"
directory?
[Of course, this would imply that we need to modify the "pom.xml"
in order to exclude the "userguide" code from the CM library JAR.]
Please let me know if this solution is fine, so that I can modify
the CM's "pom.xml" file and move the code accordingly.
Thanks,
Gilles
> On 4 January 2015 at 18:21, Gilles <gi...@harfang.homelinux.org>
> wrote:
>> Hi.
>>
>> In the "src/userguide/java" directory, there are a few
>> self-contained usage examples.
>>
>> I think that we should have some way to
>> 1. automatically compile its content (so that we can ensure that the
>> source tree does not contain any non-compilable stuff) and
>> 2. run selected classes (so that users easily see CM code at work)
>>
>> It looks like it should not be too difficult (for an experienced
>> maven user, which I'm not) to create a profile for doing just that.
>> [I've seen there is an "exec" plugin that could do (2), but I
>> didn't find where, in the "pom.xml", one can specify an alternate
>> directory for indicating which sources to compile.]
>>
>>
>> Thanks for any hint,
>> Gilles
> 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] Maven profile for running the examples?
Posted by sebb <se...@gmail.com>.
Did you see my mail from earlier today titled as below ?
Compiling and running examples
This explains how Commons NET examples are built and used.
On 4 January 2015 at 18:21, Gilles <gi...@harfang.homelinux.org> wrote:
> Hi.
>
> In the "src/userguide/java" directory, there are a few
> self-contained usage examples.
>
> I think that we should have some way to
> 1. automatically compile its content (so that we can ensure that the
> source tree does not contain any non-compilable stuff) and
> 2. run selected classes (so that users easily see CM code at work)
>
> It looks like it should not be too difficult (for an experienced
> maven user, which I'm not) to create a profile for doing just that.
> [I've seen there is an "exec" plugin that could do (2), but I
> didn't find where, in the "pom.xml", one can specify an alternate
> directory for indicating which sources to compile.]
>
>
> Thanks for any hint,
> 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