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 2013/12/29 15:39:47 UTC

[Math] src/userguide/java

Hello.

Is there some framework in place in order to generate executable files
from the Java sources located there?
I guess that a configuration snippet could be added in the "pom.xml"[1]
so that one of the build phases can also compile (and perhaps also run)
the example applications.


Regards,
Gilles

[1] I tried to use the "pom.xml" located in "src/userguide" but it 
"failed
     to resolve artefact" 
org.apache.commons:commons-math3:jar:3.3-SNAPSHOT.


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


Re: [Math] src/userguide/java

Posted by Phil Steitz <ph...@gmail.com>.
On 12/29/13, 12:38 PM, Thomas Neidhart wrote:
> On 12/29/2013 06:22 PM, Gilles wrote:
>> On Sun, 29 Dec 2013 17:36:42 +0100, Thomas Neidhart wrote:
>>> On 12/29/2013 03:39 PM, Gilles wrote:
>>>> Hello.
>>>>
>>>> Is there some framework in place in order to generate executable files
>>>> from the Java sources located there?
>>>> I guess that a configuration snippet could be added in the "pom.xml"[1]
>>>> so that one of the build phases can also compile (and perhaps also run)
>>>> the example applications.
>>> Hi Gilles,
>>>
>>> if you use eclipse with the m2eclipse plugin you can have separate
>>> projects for commons-math3 and the examples. Otherwise you would need to
>>> install the artifacts of commons-math3 into your local repository with
>>> mvn install.
>> Since all the source code being available in a sibling directory, it
>> seems that it should be possible to twist the build file so it can find
>> any requirement there.
>>
>>> To compile the examples as part of the normal build process we would
>>> need to create a parent pom for commons math3 with packaging type pom.
>> Being a very basic maven user, I cannot follow this.
>>
>> What I had in mind in something similar to the "tools" JAR being built
>> with selected classes from the "test" repository (search for the string
>> "commons-math3-tools" in the CM's "pom.xml"). [By the way, I've just
>> noticed the following line there:
>>   <attribute name="Extension-Name" value="org.apache.commons.net" />
>> and the reference to "commons.net" seems to be bug...]
>>
>> Then, using the generated JAR, one should be able to run any of the
>> "main" methods in the included class files.
> The reason why I created a separate directory with a separate pom.xml
> was to be able to include various dependencies, like xchart or others as
> needed.
>
> Of course, we could add them with scope "test" to the main pom of CM and
> move the userguide directory to the test folder and create a -examples
> jar similar to the -tools jar.
>
> This was something I had in mind first, but there was not really a
> consensus and I wanted to move on with this stuff.
>
> So I am open to make this part of CM more accessible, for now it mainly
> serves myself as testbed for small little demos / screenshots for the
> userguide.

Personally, I like the current modular setup.  The main pom is
already ugly.  Its easy to build the examples separately and having
a separate source tree and simple pom including [math] jar
dependency makes things a little easier for users to get set up and
understand the code.  I agree it would be good to regularly build
the examples and any tests they eventually include though.  Probably
best to just do that now and then and add it as a pre-release check.

Phil
>
> 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] src/userguide/java

Posted by Thomas Neidhart <th...@gmail.com>.
On 12/29/2013 06:22 PM, Gilles wrote:
> On Sun, 29 Dec 2013 17:36:42 +0100, Thomas Neidhart wrote:
>> On 12/29/2013 03:39 PM, Gilles wrote:
>>> Hello.
>>>
>>> Is there some framework in place in order to generate executable files
>>> from the Java sources located there?
>>> I guess that a configuration snippet could be added in the "pom.xml"[1]
>>> so that one of the build phases can also compile (and perhaps also run)
>>> the example applications.
>>
>> Hi Gilles,
>>
>> if you use eclipse with the m2eclipse plugin you can have separate
>> projects for commons-math3 and the examples. Otherwise you would need to
>> install the artifacts of commons-math3 into your local repository with
>> mvn install.
> 
> Since all the source code being available in a sibling directory, it
> seems that it should be possible to twist the build file so it can find
> any requirement there.
> 
>> To compile the examples as part of the normal build process we would
>> need to create a parent pom for commons math3 with packaging type pom.
> 
> Being a very basic maven user, I cannot follow this.
> 
> What I had in mind in something similar to the "tools" JAR being built
> with selected classes from the "test" repository (search for the string
> "commons-math3-tools" in the CM's "pom.xml"). [By the way, I've just
> noticed the following line there:
>   <attribute name="Extension-Name" value="org.apache.commons.net" />
> and the reference to "commons.net" seems to be bug...]
> 
> Then, using the generated JAR, one should be able to run any of the
> "main" methods in the included class files.

The reason why I created a separate directory with a separate pom.xml
was to be able to include various dependencies, like xchart or others as
needed.

Of course, we could add them with scope "test" to the main pom of CM and
move the userguide directory to the test folder and create a -examples
jar similar to the -tools jar.

This was something I had in mind first, but there was not really a
consensus and I wanted to move on with this stuff.

So I am open to make this part of CM more accessible, for now it mainly
serves myself as testbed for small little demos / screenshots for the
userguide.

Thomas

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


Re: [Math] src/userguide/java

Posted by Gilles <gi...@harfang.homelinux.org>.
On Sun, 29 Dec 2013 17:36:42 +0100, Thomas Neidhart wrote:
> On 12/29/2013 03:39 PM, Gilles wrote:
>> Hello.
>>
>> Is there some framework in place in order to generate executable 
>> files
>> from the Java sources located there?
>> I guess that a configuration snippet could be added in the 
>> "pom.xml"[1]
>> so that one of the build phases can also compile (and perhaps also 
>> run)
>> the example applications.
>
> Hi Gilles,
>
> if you use eclipse with the m2eclipse plugin you can have separate
> projects for commons-math3 and the examples. Otherwise you would need 
> to
> install the artifacts of commons-math3 into your local repository 
> with
> mvn install.

Since all the source code being available in a sibling directory, it
seems that it should be possible to twist the build file so it can find
any requirement there.

> To compile the examples as part of the normal build process we would
> need to create a parent pom for commons math3 with packaging type 
> pom.

Being a very basic maven user, I cannot follow this.

What I had in mind in something similar to the "tools" JAR being built
with selected classes from the "test" repository (search for the string
"commons-math3-tools" in the CM's "pom.xml"). [By the way, I've just
noticed the following line there:
   <attribute name="Extension-Name" value="org.apache.commons.net" />
and the reference to "commons.net" seems to be bug...]

Then, using the generated JAR, one should be able to run any of the
"main" methods in the included class files.


Gilles


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


Re: [Math] src/userguide/java

Posted by Thomas Neidhart <th...@gmail.com>.
On 12/29/2013 03:39 PM, Gilles wrote:
> Hello.
> 
> Is there some framework in place in order to generate executable files
> from the Java sources located there?
> I guess that a configuration snippet could be added in the "pom.xml"[1]
> so that one of the build phases can also compile (and perhaps also run)
> the example applications.

Hi Gilles,

if you use eclipse with the m2eclipse plugin you can have separate
projects for commons-math3 and the examples. Otherwise you would need to
install the artifacts of commons-math3 into your local repository with
mvn install.

To compile the examples as part of the normal build process we would
need to create a parent pom for commons math3 with packaging type pom.

Thomas

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


Re: [Math] src/userguide/java

Posted by Gilles <gi...@harfang.homelinux.org>.
On Tue, 31 Dec 2013 13:10:17 +0100, Benedikt Ritter wrote:
> Hey Gilles
>
>
> 2013/12/31 Gilles <gi...@harfang.homelinux.org>
>
>> On Sun, 29 Dec 2013 13:33:23 -0800, Phil Steitz wrote:
>>
>>> On 12/29/13, 6:39 AM, Gilles wrote:
>>>
>>>> Hello.
>>>>
>>>> Is there some framework in place in order to generate executable
>>>> files
>>>> from the Java sources located there?
>>>> I guess that a configuration snippet could be added in the
>>>> "pom.xml"[1]
>>>> so that one of the build phases can also compile (and perhaps also
>>>> run)
>>>> the example applications.
>>>>
>>>>
>>>> Regards,
>>>> Gilles
>>>>
>>>> [1] I tried to use the "pom.xml" located in "src/userguide" but it
>>>> "failed
>>>>     to resolve artefact"
>>>> org.apache.commons:commons-math3:jar:3.3-SNAPSHOT.
>>>>
>>>
>>> You need to install the [math] snapshot locally for maven to be 
>>> able
>>> to resolve it.  Run "mvn install" to get a current snapshot
>>> installed locally.
>>>
>>
>> OK. That's easy enough for me at the moment.
>> [I just wanted to check that what I put under "src/userguide/java"
>> does compile and run.]
>> However, I wonder why it is deemed better to have another "pom.xml"
>> rather than have the main one generate the "examples" JAR.
>>
>
> Have a look here [1]. Bottom line is, that creating multiple 
> artifacts from
> one class path violates one of the core concepts of maven: 
> modularity.

I'm fine with simplifying the main "pom.xml" (i.e. use another for 
creating
the "tools" JAR and yet another to create the "examples" JAR) but this 
must
somehow be integrated in the "workflow" (i.e. by adding a few lines to 
the
recipe in "doc/release") so that when preparing a release, everything 
will
be generated and copied to the appropriate place.

Regards,
Gilles

>
> HTH
> Benedikt
>
> [1]
> 
> http://blog.sonatype.com/2010/01/how-to-create-two-jars-from-one-project-and-why-you-shouldnt/#.UsKy2XkiOgk
>
>
>>
>>
>> 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] src/userguide/java

Posted by Benedikt Ritter <br...@apache.org>.
Hey Gilles


2013/12/31 Gilles <gi...@harfang.homelinux.org>

> On Sun, 29 Dec 2013 13:33:23 -0800, Phil Steitz wrote:
>
>> On 12/29/13, 6:39 AM, Gilles wrote:
>>
>>> Hello.
>>>
>>> Is there some framework in place in order to generate executable
>>> files
>>> from the Java sources located there?
>>> I guess that a configuration snippet could be added in the
>>> "pom.xml"[1]
>>> so that one of the build phases can also compile (and perhaps also
>>> run)
>>> the example applications.
>>>
>>>
>>> Regards,
>>> Gilles
>>>
>>> [1] I tried to use the "pom.xml" located in "src/userguide" but it
>>> "failed
>>>     to resolve artefact"
>>> org.apache.commons:commons-math3:jar:3.3-SNAPSHOT.
>>>
>>
>> You need to install the [math] snapshot locally for maven to be able
>> to resolve it.  Run "mvn install" to get a current snapshot
>> installed locally.
>>
>
> OK. That's easy enough for me at the moment.
> [I just wanted to check that what I put under "src/userguide/java"
> does compile and run.]
> However, I wonder why it is deemed better to have another "pom.xml"
> rather than have the main one generate the "examples" JAR.
>

Have a look here [1]. Bottom line is, that creating multiple artifacts from
one class path violates one of the core concepts of maven: modularity.

HTH
Benedikt

[1]
http://blog.sonatype.com/2010/01/how-to-create-two-jars-from-one-project-and-why-you-shouldnt/#.UsKy2XkiOgk


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


-- 
http://people.apache.org/~britter/
http://www.systemoutprintln.de/
http://twitter.com/BenediktRitter
http://github.com/britter

Re: [Math] src/userguide/java

Posted by Ted Dunning <te...@gmail.com>.
In my experience, examples are most useful as ... well ... examples.  As
such, they should be an example of how user code works.  That means that
they should be a complete stand-alone project, just as most user programs
should be complete and standalone.

If you want to also deliver a pre-compiled version of the examples, that's
great.  But it doesn't affect the desirability of a stand-alone project.



On Tue, Dec 31, 2013 at 9:25 AM, Gilles <gi...@harfang.homelinux.org>wrote:

> On Tue, 31 Dec 2013 08:54:59 -0700, Phil Steitz wrote:
>
>> On Dec 31, 2013, at 4:34 AM, Gilles <gi...@harfang.homelinux.org> wrote:
>>>
>>>  On Sun, 29 Dec 2013 13:33:23 -0800, Phil Steitz wrote:
>>>>
>>>>> On 12/29/13, 6:39 AM, Gilles wrote:
>>>>> Hello.
>>>>>
>>>>> Is there some framework in place in order to generate executable
>>>>> files
>>>>> from the Java sources located there?
>>>>> I guess that a configuration snippet could be added in the
>>>>> "pom.xml"[1]
>>>>> so that one of the build phases can also compile (and perhaps also
>>>>> run)
>>>>> the example applications.
>>>>>
>>>>>
>>>>> Regards,
>>>>> Gilles
>>>>>
>>>>> [1] I tried to use the "pom.xml" located in "src/userguide" but it
>>>>> "failed
>>>>>    to resolve artefact"
>>>>> org.apache.commons:commons-math3:jar:3.3-SNAPSHOT.
>>>>>
>>>>
>>>> You need to install the [math] snapshot locally for maven to be able
>>>> to resolve it.  Run "mvn install" to get a current snapshot
>>>> installed locally.
>>>>
>>>
>>> OK. That's easy enough for me at the moment.
>>> [I just wanted to check that what I put under "src/userguide/java"
>>> does compile and run.]
>>> However, I wonder why it is deemed better to have another "pom.xml"
>>> rather than have the main one generate the "examples" JAR.
>>>
>>>
>> Why exactly would one want to generate the "examples" jar?  I get the
>> use case for us of wanting to make sure they build, but for people
>> wanting to use them as reference it would seem a self-contained build
>> might be a little easier to work with.  Setting it up the way it is
>> now also makes it easy to test against prior releases. Also, the self
>> contained build is faster.
>>
>
> People may want to _run_ the examples, without the requirement to have
> maven installed.
>
>
> Gilles
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

Re: [Math] src/userguide/java

Posted by Gilles <gi...@harfang.homelinux.org>.
On Tue, 31 Dec 2013 08:54:59 -0700, Phil Steitz wrote:
>> On Dec 31, 2013, at 4:34 AM, Gilles <gi...@harfang.homelinux.org> 
>> wrote:
>>
>>> On Sun, 29 Dec 2013 13:33:23 -0800, Phil Steitz wrote:
>>>> On 12/29/13, 6:39 AM, Gilles wrote:
>>>> Hello.
>>>>
>>>> Is there some framework in place in order to generate executable
>>>> files
>>>> from the Java sources located there?
>>>> I guess that a configuration snippet could be added in the
>>>> "pom.xml"[1]
>>>> so that one of the build phases can also compile (and perhaps also
>>>> run)
>>>> the example applications.
>>>>
>>>>
>>>> Regards,
>>>> Gilles
>>>>
>>>> [1] I tried to use the "pom.xml" located in "src/userguide" but it
>>>> "failed
>>>>    to resolve artefact"
>>>> org.apache.commons:commons-math3:jar:3.3-SNAPSHOT.
>>>
>>> You need to install the [math] snapshot locally for maven to be 
>>> able
>>> to resolve it.  Run "mvn install" to get a current snapshot
>>> installed locally.
>>
>> OK. That's easy enough for me at the moment.
>> [I just wanted to check that what I put under "src/userguide/java"
>> does compile and run.]
>> However, I wonder why it is deemed better to have another "pom.xml"
>> rather than have the main one generate the "examples" JAR.
>>
>
> Why exactly would one want to generate the "examples" jar?  I get the
> use case for us of wanting to make sure they build, but for people
> wanting to use them as reference it would seem a self-contained build
> might be a little easier to work with.  Setting it up the way it is
> now also makes it easy to test against prior releases. Also, the self
> contained build is faster.

People may want to _run_ the examples, without the requirement to have
maven installed.

Gilles


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


Re: [Math] src/userguide/java

Posted by Phil Steitz <ph...@gmail.com>.

> On Dec 31, 2013, at 4:34 AM, Gilles <gi...@harfang.homelinux.org> wrote:
> 
>> On Sun, 29 Dec 2013 13:33:23 -0800, Phil Steitz wrote:
>>> On 12/29/13, 6:39 AM, Gilles wrote:
>>> Hello.
>>> 
>>> Is there some framework in place in order to generate executable
>>> files
>>> from the Java sources located there?
>>> I guess that a configuration snippet could be added in the
>>> "pom.xml"[1]
>>> so that one of the build phases can also compile (and perhaps also
>>> run)
>>> the example applications.
>>> 
>>> 
>>> Regards,
>>> Gilles
>>> 
>>> [1] I tried to use the "pom.xml" located in "src/userguide" but it
>>> "failed
>>>    to resolve artefact"
>>> org.apache.commons:commons-math3:jar:3.3-SNAPSHOT.
>> 
>> You need to install the [math] snapshot locally for maven to be able
>> to resolve it.  Run "mvn install" to get a current snapshot
>> installed locally.
> 
> OK. That's easy enough for me at the moment.
> [I just wanted to check that what I put under "src/userguide/java"
> does compile and run.]
> However, I wonder why it is deemed better to have another "pom.xml"
> rather than have the main one generate the "examples" JAR.
> 

Why exactly would one want to generate the "examples" jar?  I get the use case for us of wanting to make sure they build, but for people wanting to use them as reference it would seem a self-contained build might be a little easier to work with.  Setting it up the way it is now also makes it easy to test against prior releases. Also, the self contained build is faster.

Phil
> 
> 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] src/userguide/java

Posted by Gilles <gi...@harfang.homelinux.org>.
On Sun, 29 Dec 2013 13:33:23 -0800, Phil Steitz wrote:
> On 12/29/13, 6:39 AM, Gilles wrote:
>> Hello.
>>
>> Is there some framework in place in order to generate executable
>> files
>> from the Java sources located there?
>> I guess that a configuration snippet could be added in the
>> "pom.xml"[1]
>> so that one of the build phases can also compile (and perhaps also
>> run)
>> the example applications.
>>
>>
>> Regards,
>> Gilles
>>
>> [1] I tried to use the "pom.xml" located in "src/userguide" but it
>> "failed
>>     to resolve artefact"
>> org.apache.commons:commons-math3:jar:3.3-SNAPSHOT.
>
> You need to install the [math] snapshot locally for maven to be able
> to resolve it.  Run "mvn install" to get a current snapshot
> installed locally.

OK. That's easy enough for me at the moment.
[I just wanted to check that what I put under "src/userguide/java"
does compile and run.]
However, I wonder why it is deemed better to have another "pom.xml"
rather than have the main one generate the "examples" JAR.


Thanks,
Gilles


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


Re: [Math] src/userguide/java

Posted by Phil Steitz <ph...@gmail.com>.
On 12/29/13, 6:39 AM, Gilles wrote:
> Hello.
>
> Is there some framework in place in order to generate executable
> files
> from the Java sources located there?
> I guess that a configuration snippet could be added in the
> "pom.xml"[1]
> so that one of the build phases can also compile (and perhaps also
> run)
> the example applications.
>
>
> Regards,
> Gilles
>
> [1] I tried to use the "pom.xml" located in "src/userguide" but it
> "failed
>     to resolve artefact"
> org.apache.commons:commons-math3:jar:3.3-SNAPSHOT.

You need to install the [math] snapshot locally for maven to be able
to resolve it.  Run "mvn install" to get a current snapshot
installed locally.

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