BaseX friends,
If I run BaseX from Maven, do I always get to use the latest BaseX?
Do I have to do anything special to set up BaseX in Maven to use SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in my BaseX lib.)
Thanks! Wendell
Hi Wendell,
no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release:
<dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>7.9</version> </dependency>
For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency:
<dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>SAXON-VERSION-YOU-LIKE</version> </dependency>
Cheers, Dirk
On 01/18/2015 10:29 PM, Wendell Piez wrote:
BaseX friends,
If I run BaseX from Maven, do I always get to use the latest BaseX?
Do I have to do anything special to set up BaseX in Maven to use SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in my BaseX lib.)
Thanks! Wendell
Hi Wendell, hi Dirk,
I'd like to jump in: Depending on the use case, I think I can absolutely make sense to work with the snapshot. The more feedback we get on potential errors, the more we'll be forced to keep it as stable as possible, and write more test cases ensuring it. Moreover, obviously, you'll always have access to the latest features.
This is how your maven snippet needs to look like:
<dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>8.0-SNAPSHOT</version> </dependency>
Hope this helps, Christian
On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release:
<dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>7.9</version>
</dependency>
For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency:
<dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>SAXON-VERSION-YOU-LIKE</version> </dependency>
Cheers, Dirk
On 01/18/2015 10:29 PM, Wendell Piez wrote:
BaseX friends,
If I run BaseX from Maven, do I always get to use the latest BaseX?
Do I have to do anything special to set up BaseX in Maven to use SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in my BaseX lib.)
Thanks! Wendell
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
Dear Christian and Dirk,
For all us Maven innoscenti, I wonder if you could recommend which maven archetype one should use when getting started running BaseX? (Any guidance or resource appreciated.)
I am guessing something with 'webapp' but I have no idea, I don't even know what "webapp" means in this context (although I think it may be what I want).
Cordially, Wendell
On Mon, Jan 19, 2015 at 1:55 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell, hi Dirk,
I'd like to jump in: Depending on the use case, I think I can absolutely make sense to work with the snapshot. The more feedback we get on potential errors, the more we'll be forced to keep it as stable as possible, and write more test cases ensuring it. Moreover, obviously, you'll always have access to the latest features.
This is how your maven snippet needs to look like:
<dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>8.0-SNAPSHOT</version> </dependency>
Hope this helps, Christian
On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release:
<dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>7.9</version>
</dependency>
For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency:
<dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>SAXON-VERSION-YOU-LIKE</version> </dependency>
Cheers, Dirk
On 01/18/2015 10:29 PM, Wendell Piez wrote:
BaseX friends,
If I run BaseX from Maven, do I always get to use the latest BaseX?
Do I have to do anything special to set up BaseX in Maven to use SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in my BaseX lib.)
Thanks! Wendell
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
Gentlemen,
Also ... among tradeoffs I face ... at least one of my projects is going to need to be able to call BaseX from the shell ... i.e. not just interact with it via RestXQ.
For that, am I best off simply installing BaseX, or will I be able to do that also running under Maven?
Thanks again, Wendell
On Tue, Feb 3, 2015 at 4:47 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian and Dirk,
For all us Maven innoscenti, I wonder if you could recommend which maven archetype one should use when getting started running BaseX? (Any guidance or resource appreciated.)
I am guessing something with 'webapp' but I have no idea, I don't even know what "webapp" means in this context (although I think it may be what I want).
Cordially, Wendell
On Mon, Jan 19, 2015 at 1:55 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell, hi Dirk,
I'd like to jump in: Depending on the use case, I think I can absolutely make sense to work with the snapshot. The more feedback we get on potential errors, the more we'll be forced to keep it as stable as possible, and write more test cases ensuring it. Moreover, obviously, you'll always have access to the latest features.
This is how your maven snippet needs to look like:
<dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>8.0-SNAPSHOT</version> </dependency>
Hope this helps, Christian
On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release:
<dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>7.9</version>
</dependency>
For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency:
<dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>SAXON-VERSION-YOU-LIKE</version> </dependency>
Cheers, Dirk
On 01/18/2015 10:29 PM, Wendell Piez wrote:
BaseX friends,
If I run BaseX from Maven, do I always get to use the latest BaseX?
Do I have to do anything special to set up BaseX in Maven to use SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in my BaseX lib.)
Thanks! Wendell
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
Hi Wendell,
For all us Maven innoscenti, I wonder if you could recommend which maven archetype one should use when getting started running BaseX? (Any guidance or resource appreciated.)
I would like to redirect you to our Wiki documentation [1]. Does it help, or do you think some essential information is missing here (which we could/should add)?
It's absolutely ok to run BaseX without Maven. The easiest thing is to use the zip file and start "basexhttp" (see e.g. [2] for more information).
Best, Christian
[1] http://docs.basex.org/wiki/Maven [2] http://docs.basex.org/wiki/Startup
On Tue, Feb 3, 2015 at 10:47 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian and Dirk,
I am guessing something with 'webapp' but I have no idea, I don't even know what "webapp" means in this context (although I think it may be what I want).
Cordially, Wendell
On Mon, Jan 19, 2015 at 1:55 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell, hi Dirk,
I'd like to jump in: Depending on the use case, I think I can absolutely make sense to work with the snapshot. The more feedback we get on potential errors, the more we'll be forced to keep it as stable as possible, and write more test cases ensuring it. Moreover, obviously, you'll always have access to the latest features.
This is how your maven snippet needs to look like:
<dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>8.0-SNAPSHOT</version> </dependency>
Hope this helps, Christian
On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release:
<dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>7.9</version>
</dependency>
For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency:
<dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>SAXON-VERSION-YOU-LIKE</version> </dependency>
Cheers, Dirk
On 01/18/2015 10:29 PM, Wendell Piez wrote:
BaseX friends,
If I run BaseX from Maven, do I always get to use the latest BaseX?
Do I have to do anything special to set up BaseX in Maven to use SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in my BaseX lib.)
Thanks! Wendell
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
Dear Christian,
Absolutely, the BaseX wiki page helps.
The one thing I am stuck on is the selection of the Maven archetype. I vaguely get that it will generate a POM (an editable and extensible configuration file) and a subdirectory structure, wherein I can develop my BaseX application.
But *which* Maven archetype of the many available is the appropriate one for my needs ... I cannot pretend to know.
I do not, however, wish to compile BaseX locally -- or at least, that is not a goal. (As a means to an end I can be convinced it'd be okay.) I won't be extending or manipulating BaseX itself or writing any Java; all my code is XQuery and XSLT.
(Indeed, minimizing a dependency on BaseX -- maintaining the capability to use the same libraries in another framework or environment -- such as Apache Cocoon, XProc pipelines, eXist, MarkLogic, what have you -- is a strategic goal for me. BaseX's support of standards along with its ease of use is thus very important to me.)
Currently, I have everything running well from a single BaseX installation, without Maven (tweaking the RESTXQ directory setting to point it to my project). However, I have more than one project using BaseX, and wish to keep them independent.
I am considering Maven as a good way for me to set up and configure BaseX, with minimal overhead, in a portable and project-specific way, not to customize or compile it, but just to run it ... call a script to update a database, then call another to start the http server ...
But my goal would also be accomplished if I knew how to do something comparatively simple (or so I would think): start up BaseX to run with a project-specific runtime setting.
So Dirk suggests a script that runs
export BASEX_JVM=-p=/my/restxq/directory && basexhttp
which I could totally do, as soon as I upgrade BaseX to v8.0.
Or, if Maven is a simple, clean, and lightweight way to do it, I'm not opposed. It's how that would or could work (in specific) for me, that has me stumped. I can type mvn generate:archetype and then fake it, and I can edit the POM and sniff around in the directory structure ... feeling increasingly like a blind monkey, if you get my drift.
But Dirk urged that I help support other newbies by asking these questions in public, albeit they are slightly OT (Maven, Linux scripting), since they have to do with setting up and running BaseX ...
So what's the appropriate maven archetype for me given I wish to run BaseX but not compile any Java, per se?
Thanks! Wendell
On Wed, Feb 4, 2015 at 2:58 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell,
For all us Maven innoscenti, I wonder if you could recommend which maven archetype one should use when getting started running BaseX? (Any guidance or resource appreciated.)
I would like to redirect you to our Wiki documentation [1]. Does it help, or do you think some essential information is missing here (which we could/should add)?
It's absolutely ok to run BaseX without Maven. The easiest thing is to use the zip file and start "basexhttp" (see e.g. [2] for more information).
Best, Christian
[1] http://docs.basex.org/wiki/Maven [2] http://docs.basex.org/wiki/Startup
On Tue, Feb 3, 2015 at 10:47 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian and Dirk,
I am guessing something with 'webapp' but I have no idea, I don't even know what "webapp" means in this context (although I think it may be what I want).
Cordially, Wendell
On Mon, Jan 19, 2015 at 1:55 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell, hi Dirk,
I'd like to jump in: Depending on the use case, I think I can absolutely make sense to work with the snapshot. The more feedback we get on potential errors, the more we'll be forced to keep it as stable as possible, and write more test cases ensuring it. Moreover, obviously, you'll always have access to the latest features.
This is how your maven snippet needs to look like:
<dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>8.0-SNAPSHOT</version> </dependency>
Hope this helps, Christian
On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release:
<dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>7.9</version>
</dependency>
For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency:
<dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>SAXON-VERSION-YOU-LIKE</version> </dependency>
Cheers, Dirk
On 01/18/2015 10:29 PM, Wendell Piez wrote:
BaseX friends,
If I run BaseX from Maven, do I always get to use the latest BaseX?
Do I have to do anything special to set up BaseX in Maven to use SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in my BaseX lib.)
Thanks! Wendell
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
Hi again Christian and Dirk:
I should also mention - another goal for me is that things be self-contained enough that I can share the whole thing on github, like here:
https://github.com/wendellpiez/Luminescent
Of course this is a huge mess since it has been architected by accretion, but the idea is that I (or anyone) would be able to download the stuff and start playing as quickly as possible. Mind you, this is meant as a long-term backup and project management strategy for me as much as anything -- since the point is less the processing than the results. However, I am working on the assumption that any improvement for anyone is an improvement for myself.
I don't need to deliver BaseX to my user, but I would like to give users (my future self) an easy way to run BaseX with the necessary settings and resources available, to get my XSLT/XQuery-driven functionality onto their systems and screens as speedily as possible.
Thanks again, Wendell
On Wed, Feb 4, 2015 at 12:36 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian,
Absolutely, the BaseX wiki page helps.
The one thing I am stuck on is the selection of the Maven archetype. I vaguely get that it will generate a POM (an editable and extensible configuration file) and a subdirectory structure, wherein I can develop my BaseX application.
But *which* Maven archetype of the many available is the appropriate one for my needs ... I cannot pretend to know.
I do not, however, wish to compile BaseX locally -- or at least, that is not a goal. (As a means to an end I can be convinced it'd be okay.) I won't be extending or manipulating BaseX itself or writing any Java; all my code is XQuery and XSLT.
(Indeed, minimizing a dependency on BaseX -- maintaining the capability to use the same libraries in another framework or environment -- such as Apache Cocoon, XProc pipelines, eXist, MarkLogic, what have you -- is a strategic goal for me. BaseX's support of standards along with its ease of use is thus very important to me.)
Currently, I have everything running well from a single BaseX installation, without Maven (tweaking the RESTXQ directory setting to point it to my project). However, I have more than one project using BaseX, and wish to keep them independent.
I am considering Maven as a good way for me to set up and configure BaseX, with minimal overhead, in a portable and project-specific way, not to customize or compile it, but just to run it ... call a script to update a database, then call another to start the http server ...
But my goal would also be accomplished if I knew how to do something comparatively simple (or so I would think): start up BaseX to run with a project-specific runtime setting.
So Dirk suggests a script that runs
export BASEX_JVM=-p=/my/restxq/directory && basexhttp
which I could totally do, as soon as I upgrade BaseX to v8.0.
Or, if Maven is a simple, clean, and lightweight way to do it, I'm not opposed. It's how that would or could work (in specific) for me, that has me stumped. I can type mvn generate:archetype and then fake it, and I can edit the POM and sniff around in the directory structure ... feeling increasingly like a blind monkey, if you get my drift.
But Dirk urged that I help support other newbies by asking these questions in public, albeit they are slightly OT (Maven, Linux scripting), since they have to do with setting up and running BaseX ...
So what's the appropriate maven archetype for me given I wish to run BaseX but not compile any Java, per se?
Thanks! Wendell
On Wed, Feb 4, 2015 at 2:58 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell,
For all us Maven innoscenti, I wonder if you could recommend which maven archetype one should use when getting started running BaseX? (Any guidance or resource appreciated.)
I would like to redirect you to our Wiki documentation [1]. Does it help, or do you think some essential information is missing here (which we could/should add)?
It's absolutely ok to run BaseX without Maven. The easiest thing is to use the zip file and start "basexhttp" (see e.g. [2] for more information).
Best, Christian
[1] http://docs.basex.org/wiki/Maven [2] http://docs.basex.org/wiki/Startup
On Tue, Feb 3, 2015 at 10:47 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian and Dirk,
I am guessing something with 'webapp' but I have no idea, I don't even know what "webapp" means in this context (although I think it may be what I want).
Cordially, Wendell
On Mon, Jan 19, 2015 at 1:55 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell, hi Dirk,
I'd like to jump in: Depending on the use case, I think I can absolutely make sense to work with the snapshot. The more feedback we get on potential errors, the more we'll be forced to keep it as stable as possible, and write more test cases ensuring it. Moreover, obviously, you'll always have access to the latest features.
This is how your maven snippet needs to look like:
<dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>8.0-SNAPSHOT</version> </dependency>
Hope this helps, Christian
On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release:
<dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>7.9</version>
</dependency>
For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency:
<dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>SAXON-VERSION-YOU-LIKE</version> </dependency>
Cheers, Dirk
On 01/18/2015 10:29 PM, Wendell Piez wrote:
BaseX friends,
If I run BaseX from Maven, do I always get to use the latest BaseX?
Do I have to do anything special to set up BaseX in Maven to use SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in my BaseX lib.)
Thanks! Wendell
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
Hi Wendell,
I have attached a sample pom.xml file. This should allow you to cover your two main use cases (at least, that is what I see here): 1) Starting a Jetty server, so you can run RestXQ and 2) Running BaseX standalone so you can e.g. run a script
Using the exec maven plugin you can run any java program from Maven. So this part
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>org.basex.BaseX</mainClass> <arguments> <argument>-q 4+2</argument> </arguments> </configuration> </plugin>
simply output 6 if run via
mvn exec:java
You can also override the arguments via command line like so
mvn exec:java -Dexec.args="-q 7+1"
Starting jetty can be done as usual running mvn jetty:run
I would recommend you have such a pom.xml file in each of your project directories. This allows you e.g. to use different BaseX versions for your different projects (your latest project might want to use our 8.0 snapshot, your potential high-security banking project in production most likely should not run unstable software) . In the pom.files you can also incorporate different JVM parameters (as I suggested before using export BASEX_JVM=-p=/my/restxq/directory && basexhttp, but this time using maven).
If you use Maven in general, it does not mean you have to compile anything at all. On the contrary, it allows programmers to fetch already compiled versions and fit them into their program.
I should not that you could also use a more complex Maven approach and use a parent pom.xml file and subprojects (we do this in the core BaseX files, as basex-core and basex-api are actually different projects, bundled together in a parent project). This is all Maven specific - Maven is a build system, sou basically you can do almost anything. Question is, how much you want to dive into Maven configuration or if it is good enough for you for now to simple have something you can share and others can check out easily.
If you have a project with such an pom.xml file and you share it e.g. via github, it should be enough for your users to check out the repository and run e.g. mvn jetty:run. Of course, you can then also write maven goals for repeating task, e.g. optimizing the database. So you than would have to write a simple mvn exec:optimize, which would call BaseX with the require parameters to do your optimization.
Of course, you could also do all this completely without Maven. You could also write custom shell scripts and automatically download BaseX, etc. pp. Essentially, Maven is just a tool which saves you same work and simplifies dependency-management.
Regarding the maven archetypes, I don't think we use them at all. I don't have much knowledge about them (also about Maven, I just use it as a tool, but I am always amazed how complex it is), but I guess we would have to write same sample archetypes for them - Which we didn't, as far as I know.
And sorry about being pedantic on using the mailing list. But I truly think many people stumble onto the problems faced with project setup and Maven usage, so I think these people can benefit.
I hope this helps.
Cheers Dirk
On 02/04/2015 06:52 PM, Wendell Piez wrote:
Hi again Christian and Dirk:
I should also mention - another goal for me is that things be self-contained enough that I can share the whole thing on github, like here:
https://github.com/wendellpiez/Luminescent
Of course this is a huge mess since it has been architected by accretion, but the idea is that I (or anyone) would be able to download the stuff and start playing as quickly as possible. Mind you, this is meant as a long-term backup and project management strategy for me as much as anything -- since the point is less the processing than the results. However, I am working on the assumption that any improvement for anyone is an improvement for myself.
I don't need to deliver BaseX to my user, but I would like to give users (my future self) an easy way to run BaseX with the necessary settings and resources available, to get my XSLT/XQuery-driven functionality onto their systems and screens as speedily as possible.
Thanks again, Wendell
On Wed, Feb 4, 2015 at 12:36 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian,
Absolutely, the BaseX wiki page helps.
The one thing I am stuck on is the selection of the Maven archetype. I vaguely get that it will generate a POM (an editable and extensible configuration file) and a subdirectory structure, wherein I can develop my BaseX application.
But *which* Maven archetype of the many available is the appropriate one for my needs ... I cannot pretend to know.
I do not, however, wish to compile BaseX locally -- or at least, that is not a goal. (As a means to an end I can be convinced it'd be okay.) I won't be extending or manipulating BaseX itself or writing any Java; all my code is XQuery and XSLT.
(Indeed, minimizing a dependency on BaseX -- maintaining the capability to use the same libraries in another framework or environment -- such as Apache Cocoon, XProc pipelines, eXist, MarkLogic, what have you -- is a strategic goal for me. BaseX's support of standards along with its ease of use is thus very important to me.)
Currently, I have everything running well from a single BaseX installation, without Maven (tweaking the RESTXQ directory setting to point it to my project). However, I have more than one project using BaseX, and wish to keep them independent.
I am considering Maven as a good way for me to set up and configure BaseX, with minimal overhead, in a portable and project-specific way, not to customize or compile it, but just to run it ... call a script to update a database, then call another to start the http server ...
But my goal would also be accomplished if I knew how to do something comparatively simple (or so I would think): start up BaseX to run with a project-specific runtime setting.
So Dirk suggests a script that runs
export BASEX_JVM=-p=/my/restxq/directory && basexhttp
which I could totally do, as soon as I upgrade BaseX to v8.0.
Or, if Maven is a simple, clean, and lightweight way to do it, I'm not opposed. It's how that would or could work (in specific) for me, that has me stumped. I can type mvn generate:archetype and then fake it, and I can edit the POM and sniff around in the directory structure ... feeling increasingly like a blind monkey, if you get my drift.
But Dirk urged that I help support other newbies by asking these questions in public, albeit they are slightly OT (Maven, Linux scripting), since they have to do with setting up and running BaseX ...
So what's the appropriate maven archetype for me given I wish to run BaseX but not compile any Java, per se?
Thanks! Wendell
On Wed, Feb 4, 2015 at 2:58 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell,
For all us Maven innoscenti, I wonder if you could recommend which maven archetype one should use when getting started running BaseX? (Any guidance or resource appreciated.)
I would like to redirect you to our Wiki documentation [1]. Does it help, or do you think some essential information is missing here (which we could/should add)?
It's absolutely ok to run BaseX without Maven. The easiest thing is to use the zip file and start "basexhttp" (see e.g. [2] for more information).
Best, Christian
[1] http://docs.basex.org/wiki/Maven [2] http://docs.basex.org/wiki/Startup
On Tue, Feb 3, 2015 at 10:47 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian and Dirk,
I am guessing something with 'webapp' but I have no idea, I don't even know what "webapp" means in this context (although I think it may be what I want).
Cordially, Wendell
On Mon, Jan 19, 2015 at 1:55 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell, hi Dirk,
I'd like to jump in: Depending on the use case, I think I can absolutely make sense to work with the snapshot. The more feedback we get on potential errors, the more we'll be forced to keep it as stable as possible, and write more test cases ensuring it. Moreover, obviously, you'll always have access to the latest features.
This is how your maven snippet needs to look like:
<dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>8.0-SNAPSHOT</version> </dependency>
Hope this helps, Christian
On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release:
<dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>7.9</version>
</dependency>
For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency:
<dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>SAXON-VERSION-YOU-LIKE</version> </dependency>
Cheers, Dirk
On 01/18/2015 10:29 PM, Wendell Piez wrote: > BaseX friends, > > If I run BaseX from Maven, do I always get to use the latest BaseX? > > Do I have to do anything special to set up BaseX in Maven to use > SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in > my BaseX lib.) > > Thanks! Wendell > >
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
Dear Dirk,
Thanks for all the input and advice! It is a great deal to digest, but I am sure I will figure it out.
My questions about which archetype to use stem from the fact that every How-to-start-with-Maven tutorial tells me to choose an archetype, and I simply don't know enough to guess how I would skip this step or follow it.
It is completely possible I have just chased myself into a rathole with this (in which case forgive me). I am sure the lightbulb will go on if I just persist.
However, your advice does raise a couple of other questions:
1. My projects all require SaxonHE. BaseX is very good about using SaxonHE if I put a copy of the Saxon .jar into BaseX itself -- as it will be presumably if I simply put saxon9he.jar on the classpath.
What do I do to get SaxonHE into BaseX under Maven? I can list it in the pom.xml - is it as simple as this? If this is the approach, then I guess I don't have to mess with its (or anyone's) .jar files? (which is the point of the exercise? :-)
2. Where does BaseX store its databases when I run it under Maven?
I'm sure I'll have more questions. Thanks again.
Cheers, Wendell
On Thu, Feb 5, 2015 at 5:49 AM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
I have attached a sample pom.xml file. This should allow you to cover your two main use cases (at least, that is what I see here): 1) Starting a Jetty server, so you can run RestXQ and 2) Running BaseX standalone so you can e.g. run a script
Using the exec maven plugin you can run any java program from Maven. So this part
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>org.basex.BaseX</mainClass> <arguments> <argument>-q 4+2</argument> </arguments> </configuration> </plugin>
simply output 6 if run via
mvn exec:java
You can also override the arguments via command line like so
mvn exec:java -Dexec.args="-q 7+1"
Starting jetty can be done as usual running mvn jetty:run
I would recommend you have such a pom.xml file in each of your project directories. This allows you e.g. to use different BaseX versions for your different projects (your latest project might want to use our 8.0 snapshot, your potential high-security banking project in production most likely should not run unstable software) . In the pom.files you can also incorporate different JVM parameters (as I suggested before using export BASEX_JVM=-p=/my/restxq/directory && basexhttp, but this time using maven).
If you use Maven in general, it does not mean you have to compile anything at all. On the contrary, it allows programmers to fetch already compiled versions and fit them into their program.
I should not that you could also use a more complex Maven approach and use a parent pom.xml file and subprojects (we do this in the core BaseX files, as basex-core and basex-api are actually different projects, bundled together in a parent project). This is all Maven specific - Maven is a build system, sou basically you can do almost anything. Question is, how much you want to dive into Maven configuration or if it is good enough for you for now to simple have something you can share and others can check out easily.
If you have a project with such an pom.xml file and you share it e.g. via github, it should be enough for your users to check out the repository and run e.g. mvn jetty:run. Of course, you can then also write maven goals for repeating task, e.g. optimizing the database. So you than would have to write a simple mvn exec:optimize, which would call BaseX with the require parameters to do your optimization.
Of course, you could also do all this completely without Maven. You could also write custom shell scripts and automatically download BaseX, etc. pp. Essentially, Maven is just a tool which saves you same work and simplifies dependency-management.
Regarding the maven archetypes, I don't think we use them at all. I don't have much knowledge about them (also about Maven, I just use it as a tool, but I am always amazed how complex it is), but I guess we would have to write same sample archetypes for them - Which we didn't, as far as I know.
And sorry about being pedantic on using the mailing list. But I truly think many people stumble onto the problems faced with project setup and Maven usage, so I think these people can benefit.
I hope this helps.
Cheers Dirk
On 02/04/2015 06:52 PM, Wendell Piez wrote:
Hi again Christian and Dirk:
I should also mention - another goal for me is that things be self-contained enough that I can share the whole thing on github, like here:
https://github.com/wendellpiez/Luminescent
Of course this is a huge mess since it has been architected by accretion, but the idea is that I (or anyone) would be able to download the stuff and start playing as quickly as possible. Mind you, this is meant as a long-term backup and project management strategy for me as much as anything -- since the point is less the processing than the results. However, I am working on the assumption that any improvement for anyone is an improvement for myself.
I don't need to deliver BaseX to my user, but I would like to give users (my future self) an easy way to run BaseX with the necessary settings and resources available, to get my XSLT/XQuery-driven functionality onto their systems and screens as speedily as possible.
Thanks again, Wendell
On Wed, Feb 4, 2015 at 12:36 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian,
Absolutely, the BaseX wiki page helps.
The one thing I am stuck on is the selection of the Maven archetype. I vaguely get that it will generate a POM (an editable and extensible configuration file) and a subdirectory structure, wherein I can develop my BaseX application.
But *which* Maven archetype of the many available is the appropriate one for my needs ... I cannot pretend to know.
I do not, however, wish to compile BaseX locally -- or at least, that is not a goal. (As a means to an end I can be convinced it'd be okay.) I won't be extending or manipulating BaseX itself or writing any Java; all my code is XQuery and XSLT.
(Indeed, minimizing a dependency on BaseX -- maintaining the capability to use the same libraries in another framework or environment -- such as Apache Cocoon, XProc pipelines, eXist, MarkLogic, what have you -- is a strategic goal for me. BaseX's support of standards along with its ease of use is thus very important to me.)
Currently, I have everything running well from a single BaseX installation, without Maven (tweaking the RESTXQ directory setting to point it to my project). However, I have more than one project using BaseX, and wish to keep them independent.
I am considering Maven as a good way for me to set up and configure BaseX, with minimal overhead, in a portable and project-specific way, not to customize or compile it, but just to run it ... call a script to update a database, then call another to start the http server ...
But my goal would also be accomplished if I knew how to do something comparatively simple (or so I would think): start up BaseX to run with a project-specific runtime setting.
So Dirk suggests a script that runs
export BASEX_JVM=-p=/my/restxq/directory && basexhttp
which I could totally do, as soon as I upgrade BaseX to v8.0.
Or, if Maven is a simple, clean, and lightweight way to do it, I'm not opposed. It's how that would or could work (in specific) for me, that has me stumped. I can type mvn generate:archetype and then fake it, and I can edit the POM and sniff around in the directory structure ... feeling increasingly like a blind monkey, if you get my drift.
But Dirk urged that I help support other newbies by asking these questions in public, albeit they are slightly OT (Maven, Linux scripting), since they have to do with setting up and running BaseX ...
So what's the appropriate maven archetype for me given I wish to run BaseX but not compile any Java, per se?
Thanks! Wendell
On Wed, Feb 4, 2015 at 2:58 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell,
For all us Maven innoscenti, I wonder if you could recommend which maven archetype one should use when getting started running BaseX? (Any guidance or resource appreciated.)
I would like to redirect you to our Wiki documentation [1]. Does it help, or do you think some essential information is missing here (which we could/should add)?
It's absolutely ok to run BaseX without Maven. The easiest thing is to use the zip file and start "basexhttp" (see e.g. [2] for more information).
Best, Christian
[1] http://docs.basex.org/wiki/Maven [2] http://docs.basex.org/wiki/Startup
On Tue, Feb 3, 2015 at 10:47 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian and Dirk,
I am guessing something with 'webapp' but I have no idea, I don't even know what "webapp" means in this context (although I think it may be what I want).
Cordially, Wendell
On Mon, Jan 19, 2015 at 1:55 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell, hi Dirk,
I'd like to jump in: Depending on the use case, I think I can absolutely make sense to work with the snapshot. The more feedback we get on potential errors, the more we'll be forced to keep it as stable as possible, and write more test cases ensuring it. Moreover, obviously, you'll always have access to the latest features.
This is how your maven snippet needs to look like:
<dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>8.0-SNAPSHOT</version> </dependency>
Hope this helps, Christian
On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote: > Hi Wendell, > > no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release: > > <dependency> > <groupId>org.basex</groupId> > <artifactId>basex-api</artifactId> > <version>7.9</version> > </dependency> > > > > > For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency: > > > <dependency> > <groupId>net.sf.saxon</groupId> > <artifactId>Saxon-HE</artifactId> > <version>SAXON-VERSION-YOU-LIKE</version> > </dependency> > > > Cheers, > Dirk > > > On 01/18/2015 10:29 PM, Wendell Piez wrote: >> BaseX friends, >> >> If I run BaseX from Maven, do I always get to use the latest BaseX? >> >> Do I have to do anything special to set up BaseX in Maven to use >> SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in >> my BaseX lib.) >> >> Thanks! Wendell >> >> > > -- > Dirk Kirsten, BaseX GmbH, http://basexgmbh.de > |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz > |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: > | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle > `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
Hello Wendell,
I guess you are correct and quite likely we should ship the archetype generators somehow, but I am personally am no Maven expert. Personally (and I think this is what everyone using Maven+BaseX is currently doing) I simply copy my default pom.xml to a new project.
Regarding your questions
1) This is quite simple and the reason why Maven is quite nice. It is in fact as simple as including
<dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>9.6.0-4</version> </dependency>
into your pom.xml (of course you can change the Saxon version number)
2) The BaseX location is configurable in the jetty configuration in this setup. You can do this either in the jetty.xml file using
<Set name="host"><SystemProperty name="org.basex.dbpath" default="/your/db/path"/></Set>
or in the web.xml using
<context-param> <param-name>org.basex.dbpath</param-name> <param-value>your/db/path</param-value> </context-param>
The default is to use the data/ directory of the directory where the pom.xml file is located.
Happy to help and to answer more questions. Maybe we can actually use this and write down some Maven+BaseX Getting started guide in our documentation.
Cheers, Dirk On 02/07/2015 08:47 PM, Wendell Piez wrote:
Dear Dirk,
Thanks for all the input and advice! It is a great deal to digest, but I am sure I will figure it out.
My questions about which archetype to use stem from the fact that every How-to-start-with-Maven tutorial tells me to choose an archetype, and I simply don't know enough to guess how I would skip this step or follow it.
It is completely possible I have just chased myself into a rathole with this (in which case forgive me). I am sure the lightbulb will go on if I just persist.
However, your advice does raise a couple of other questions:
- My projects all require SaxonHE. BaseX is very good about using
SaxonHE if I put a copy of the Saxon .jar into BaseX itself -- as it will be presumably if I simply put saxon9he.jar on the classpath.
What do I do to get SaxonHE into BaseX under Maven? I can list it in the pom.xml - is it as simple as this? If this is the approach, then I guess I don't have to mess with its (or anyone's) .jar files? (which is the point of the exercise? :-)
- Where does BaseX store its databases when I run it under Maven?
I'm sure I'll have more questions. Thanks again.
Cheers, Wendell
On Thu, Feb 5, 2015 at 5:49 AM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
I have attached a sample pom.xml file. This should allow you to cover your two main use cases (at least, that is what I see here): 1) Starting a Jetty server, so you can run RestXQ and 2) Running BaseX standalone so you can e.g. run a script
Using the exec maven plugin you can run any java program from Maven. So this part
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>org.basex.BaseX</mainClass> <arguments> <argument>-q 4+2</argument> </arguments> </configuration> </plugin>
simply output 6 if run via
mvn exec:java
You can also override the arguments via command line like so
mvn exec:java -Dexec.args="-q 7+1"
Starting jetty can be done as usual running mvn jetty:run
I would recommend you have such a pom.xml file in each of your project directories. This allows you e.g. to use different BaseX versions for your different projects (your latest project might want to use our 8.0 snapshot, your potential high-security banking project in production most likely should not run unstable software) . In the pom.files you can also incorporate different JVM parameters (as I suggested before using export BASEX_JVM=-p=/my/restxq/directory && basexhttp, but this time using maven).
If you use Maven in general, it does not mean you have to compile anything at all. On the contrary, it allows programmers to fetch already compiled versions and fit them into their program.
I should not that you could also use a more complex Maven approach and use a parent pom.xml file and subprojects (we do this in the core BaseX files, as basex-core and basex-api are actually different projects, bundled together in a parent project). This is all Maven specific - Maven is a build system, sou basically you can do almost anything. Question is, how much you want to dive into Maven configuration or if it is good enough for you for now to simple have something you can share and others can check out easily.
If you have a project with such an pom.xml file and you share it e.g. via github, it should be enough for your users to check out the repository and run e.g. mvn jetty:run. Of course, you can then also write maven goals for repeating task, e.g. optimizing the database. So you than would have to write a simple mvn exec:optimize, which would call BaseX with the require parameters to do your optimization.
Of course, you could also do all this completely without Maven. You could also write custom shell scripts and automatically download BaseX, etc. pp. Essentially, Maven is just a tool which saves you same work and simplifies dependency-management.
Regarding the maven archetypes, I don't think we use them at all. I don't have much knowledge about them (also about Maven, I just use it as a tool, but I am always amazed how complex it is), but I guess we would have to write same sample archetypes for them - Which we didn't, as far as I know.
And sorry about being pedantic on using the mailing list. But I truly think many people stumble onto the problems faced with project setup and Maven usage, so I think these people can benefit.
I hope this helps.
Cheers Dirk
On 02/04/2015 06:52 PM, Wendell Piez wrote:
Hi again Christian and Dirk:
I should also mention - another goal for me is that things be self-contained enough that I can share the whole thing on github, like here:
https://github.com/wendellpiez/Luminescent
Of course this is a huge mess since it has been architected by accretion, but the idea is that I (or anyone) would be able to download the stuff and start playing as quickly as possible. Mind you, this is meant as a long-term backup and project management strategy for me as much as anything -- since the point is less the processing than the results. However, I am working on the assumption that any improvement for anyone is an improvement for myself.
I don't need to deliver BaseX to my user, but I would like to give users (my future self) an easy way to run BaseX with the necessary settings and resources available, to get my XSLT/XQuery-driven functionality onto their systems and screens as speedily as possible.
Thanks again, Wendell
On Wed, Feb 4, 2015 at 12:36 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian,
Absolutely, the BaseX wiki page helps.
The one thing I am stuck on is the selection of the Maven archetype. I vaguely get that it will generate a POM (an editable and extensible configuration file) and a subdirectory structure, wherein I can develop my BaseX application.
But *which* Maven archetype of the many available is the appropriate one for my needs ... I cannot pretend to know.
I do not, however, wish to compile BaseX locally -- or at least, that is not a goal. (As a means to an end I can be convinced it'd be okay.) I won't be extending or manipulating BaseX itself or writing any Java; all my code is XQuery and XSLT.
(Indeed, minimizing a dependency on BaseX -- maintaining the capability to use the same libraries in another framework or environment -- such as Apache Cocoon, XProc pipelines, eXist, MarkLogic, what have you -- is a strategic goal for me. BaseX's support of standards along with its ease of use is thus very important to me.)
Currently, I have everything running well from a single BaseX installation, without Maven (tweaking the RESTXQ directory setting to point it to my project). However, I have more than one project using BaseX, and wish to keep them independent.
I am considering Maven as a good way for me to set up and configure BaseX, with minimal overhead, in a portable and project-specific way, not to customize or compile it, but just to run it ... call a script to update a database, then call another to start the http server ...
But my goal would also be accomplished if I knew how to do something comparatively simple (or so I would think): start up BaseX to run with a project-specific runtime setting.
So Dirk suggests a script that runs
export BASEX_JVM=-p=/my/restxq/directory && basexhttp
which I could totally do, as soon as I upgrade BaseX to v8.0.
Or, if Maven is a simple, clean, and lightweight way to do it, I'm not opposed. It's how that would or could work (in specific) for me, that has me stumped. I can type mvn generate:archetype and then fake it, and I can edit the POM and sniff around in the directory structure ... feeling increasingly like a blind monkey, if you get my drift.
But Dirk urged that I help support other newbies by asking these questions in public, albeit they are slightly OT (Maven, Linux scripting), since they have to do with setting up and running BaseX ...
So what's the appropriate maven archetype for me given I wish to run BaseX but not compile any Java, per se?
Thanks! Wendell
On Wed, Feb 4, 2015 at 2:58 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell,
For all us Maven innoscenti, I wonder if you could recommend which maven archetype one should use when getting started running BaseX? (Any guidance or resource appreciated.)
I would like to redirect you to our Wiki documentation [1]. Does it help, or do you think some essential information is missing here (which we could/should add)?
It's absolutely ok to run BaseX without Maven. The easiest thing is to use the zip file and start "basexhttp" (see e.g. [2] for more information).
Best, Christian
[1] http://docs.basex.org/wiki/Maven [2] http://docs.basex.org/wiki/Startup
On Tue, Feb 3, 2015 at 10:47 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian and Dirk,
I am guessing something with 'webapp' but I have no idea, I don't even know what "webapp" means in this context (although I think it may be what I want).
Cordially, Wendell
On Mon, Jan 19, 2015 at 1:55 AM, Christian Grün christian.gruen@gmail.com wrote: > Hi Wendell, hi Dirk, > > I'd like to jump in: Depending on the use case, I think I can > absolutely make sense to work with the snapshot. The more feedback we > get on potential errors, the more we'll be forced to keep it as stable > as possible, and write more test cases ensuring it. Moreover, > obviously, you'll always have access to the latest features. > > This is how your maven snippet needs to look like: > > <dependency> > <groupId>org.basex</groupId> > <artifactId>basex-api</artifactId> > <version>8.0-SNAPSHOT</version> > </dependency> > > Hope this helps, > Christian > > > On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote: >> Hi Wendell, >> >> no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release: >> >> <dependency> >> <groupId>org.basex</groupId> >> <artifactId>basex-api</artifactId> >> <version>7.9</version> >> </dependency> >> >> >> >> >> For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency: >> >> >> <dependency> >> <groupId>net.sf.saxon</groupId> >> <artifactId>Saxon-HE</artifactId> >> <version>SAXON-VERSION-YOU-LIKE</version> >> </dependency> >> >> >> Cheers, >> Dirk >> >> >> On 01/18/2015 10:29 PM, Wendell Piez wrote: >>> BaseX friends, >>> >>> If I run BaseX from Maven, do I always get to use the latest BaseX? >>> >>> Do I have to do anything special to set up BaseX in Maven to use >>> SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in >>> my BaseX lib.) >>> >>> Thanks! Wendell >>> >>> >> >> -- >> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de >> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
Hi again Dirk,
This is excellent, thanks for helping me along here.
As for maven project setup, I am pretty certain that one of the shelf-standard archetypes would do just fine -- I just don't have enough experience in Java development to be able to make educated guess which one(s) would be best. Maybe I'll make some experiments. Of course in the scenario you are suggesting, any future users of my project would not have to do that for themselves, so stumbling forward may get me to the goal as quickly as "doing it right".
If/as I grope my way, I'll try to keep notes...
Cheers, Wendell
On Sun, Feb 8, 2015 at 5:34 AM, Dirk Kirsten dk@basex.org wrote:
Hello Wendell,
I guess you are correct and quite likely we should ship the archetype generators somehow, but I am personally am no Maven expert. Personally (and I think this is what everyone using Maven+BaseX is currently doing) I simply copy my default pom.xml to a new project.
Regarding your questions
- This is quite simple and the reason why Maven is quite nice. It is in fact as simple as including
<dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>9.6.0-4</version> </dependency>
into your pom.xml (of course you can change the Saxon version number)
The BaseX location is configurable in the jetty configuration in this setup. You can do this either in the jetty.xml file using
<Set name="host"><SystemProperty name="org.basex.dbpath" default="/your/db/path"/></Set>
or in the web.xml using
<context-param> <param-name>org.basex.dbpath</param-name> <param-value>your/db/path</param-value> </context-param>
The default is to use the data/ directory of the directory where the pom.xml file is located.
Happy to help and to answer more questions. Maybe we can actually use this and write down some Maven+BaseX Getting started guide in our documentation.
Cheers, Dirk On 02/07/2015 08:47 PM, Wendell Piez wrote:
Dear Dirk,
Thanks for all the input and advice! It is a great deal to digest, but I am sure I will figure it out.
My questions about which archetype to use stem from the fact that every How-to-start-with-Maven tutorial tells me to choose an archetype, and I simply don't know enough to guess how I would skip this step or follow it.
It is completely possible I have just chased myself into a rathole with this (in which case forgive me). I am sure the lightbulb will go on if I just persist.
However, your advice does raise a couple of other questions:
- My projects all require SaxonHE. BaseX is very good about using
SaxonHE if I put a copy of the Saxon .jar into BaseX itself -- as it will be presumably if I simply put saxon9he.jar on the classpath.
What do I do to get SaxonHE into BaseX under Maven? I can list it in the pom.xml - is it as simple as this? If this is the approach, then I guess I don't have to mess with its (or anyone's) .jar files? (which is the point of the exercise? :-)
- Where does BaseX store its databases when I run it under Maven?
I'm sure I'll have more questions. Thanks again.
Cheers, Wendell
On Thu, Feb 5, 2015 at 5:49 AM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
I have attached a sample pom.xml file. This should allow you to cover your two main use cases (at least, that is what I see here): 1) Starting a Jetty server, so you can run RestXQ and 2) Running BaseX standalone so you can e.g. run a script
Using the exec maven plugin you can run any java program from Maven. So this part
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>org.basex.BaseX</mainClass> <arguments> <argument>-q 4+2</argument> </arguments> </configuration> </plugin>
simply output 6 if run via
mvn exec:java
You can also override the arguments via command line like so
mvn exec:java -Dexec.args="-q 7+1"
Starting jetty can be done as usual running mvn jetty:run
I would recommend you have such a pom.xml file in each of your project directories. This allows you e.g. to use different BaseX versions for your different projects (your latest project might want to use our 8.0 snapshot, your potential high-security banking project in production most likely should not run unstable software) . In the pom.files you can also incorporate different JVM parameters (as I suggested before using export BASEX_JVM=-p=/my/restxq/directory && basexhttp, but this time using maven).
If you use Maven in general, it does not mean you have to compile anything at all. On the contrary, it allows programmers to fetch already compiled versions and fit them into their program.
I should not that you could also use a more complex Maven approach and use a parent pom.xml file and subprojects (we do this in the core BaseX files, as basex-core and basex-api are actually different projects, bundled together in a parent project). This is all Maven specific - Maven is a build system, sou basically you can do almost anything. Question is, how much you want to dive into Maven configuration or if it is good enough for you for now to simple have something you can share and others can check out easily.
If you have a project with such an pom.xml file and you share it e.g. via github, it should be enough for your users to check out the repository and run e.g. mvn jetty:run. Of course, you can then also write maven goals for repeating task, e.g. optimizing the database. So you than would have to write a simple mvn exec:optimize, which would call BaseX with the require parameters to do your optimization.
Of course, you could also do all this completely without Maven. You could also write custom shell scripts and automatically download BaseX, etc. pp. Essentially, Maven is just a tool which saves you same work and simplifies dependency-management.
Regarding the maven archetypes, I don't think we use them at all. I don't have much knowledge about them (also about Maven, I just use it as a tool, but I am always amazed how complex it is), but I guess we would have to write same sample archetypes for them - Which we didn't, as far as I know.
And sorry about being pedantic on using the mailing list. But I truly think many people stumble onto the problems faced with project setup and Maven usage, so I think these people can benefit.
I hope this helps.
Cheers Dirk
On 02/04/2015 06:52 PM, Wendell Piez wrote:
Hi again Christian and Dirk:
I should also mention - another goal for me is that things be self-contained enough that I can share the whole thing on github, like here:
https://github.com/wendellpiez/Luminescent
Of course this is a huge mess since it has been architected by accretion, but the idea is that I (or anyone) would be able to download the stuff and start playing as quickly as possible. Mind you, this is meant as a long-term backup and project management strategy for me as much as anything -- since the point is less the processing than the results. However, I am working on the assumption that any improvement for anyone is an improvement for myself.
I don't need to deliver BaseX to my user, but I would like to give users (my future self) an easy way to run BaseX with the necessary settings and resources available, to get my XSLT/XQuery-driven functionality onto their systems and screens as speedily as possible.
Thanks again, Wendell
On Wed, Feb 4, 2015 at 12:36 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian,
Absolutely, the BaseX wiki page helps.
The one thing I am stuck on is the selection of the Maven archetype. I vaguely get that it will generate a POM (an editable and extensible configuration file) and a subdirectory structure, wherein I can develop my BaseX application.
But *which* Maven archetype of the many available is the appropriate one for my needs ... I cannot pretend to know.
I do not, however, wish to compile BaseX locally -- or at least, that is not a goal. (As a means to an end I can be convinced it'd be okay.) I won't be extending or manipulating BaseX itself or writing any Java; all my code is XQuery and XSLT.
(Indeed, minimizing a dependency on BaseX -- maintaining the capability to use the same libraries in another framework or environment -- such as Apache Cocoon, XProc pipelines, eXist, MarkLogic, what have you -- is a strategic goal for me. BaseX's support of standards along with its ease of use is thus very important to me.)
Currently, I have everything running well from a single BaseX installation, without Maven (tweaking the RESTXQ directory setting to point it to my project). However, I have more than one project using BaseX, and wish to keep them independent.
I am considering Maven as a good way for me to set up and configure BaseX, with minimal overhead, in a portable and project-specific way, not to customize or compile it, but just to run it ... call a script to update a database, then call another to start the http server ...
But my goal would also be accomplished if I knew how to do something comparatively simple (or so I would think): start up BaseX to run with a project-specific runtime setting.
So Dirk suggests a script that runs
export BASEX_JVM=-p=/my/restxq/directory && basexhttp
which I could totally do, as soon as I upgrade BaseX to v8.0.
Or, if Maven is a simple, clean, and lightweight way to do it, I'm not opposed. It's how that would or could work (in specific) for me, that has me stumped. I can type mvn generate:archetype and then fake it, and I can edit the POM and sniff around in the directory structure ... feeling increasingly like a blind monkey, if you get my drift.
But Dirk urged that I help support other newbies by asking these questions in public, albeit they are slightly OT (Maven, Linux scripting), since they have to do with setting up and running BaseX ...
So what's the appropriate maven archetype for me given I wish to run BaseX but not compile any Java, per se?
Thanks! Wendell
On Wed, Feb 4, 2015 at 2:58 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell,
> For all us Maven innoscenti, I wonder if you could recommend which > maven archetype one should use when getting started running BaseX? > (Any guidance or resource appreciated.)
I would like to redirect you to our Wiki documentation [1]. Does it help, or do you think some essential information is missing here (which we could/should add)?
It's absolutely ok to run BaseX without Maven. The easiest thing is to use the zip file and start "basexhttp" (see e.g. [2] for more information).
Best, Christian
[1] http://docs.basex.org/wiki/Maven [2] http://docs.basex.org/wiki/Startup
On Tue, Feb 3, 2015 at 10:47 PM, Wendell Piez wapiez@wendellpiez.com wrote: > Dear Christian and Dirk, > > > I am guessing something with 'webapp' but I have no idea, I don't even > know what "webapp" means in this context (although I think it may be > what I want). > > Cordially, Wendell > > > > On Mon, Jan 19, 2015 at 1:55 AM, Christian Grün > christian.gruen@gmail.com wrote: >> Hi Wendell, hi Dirk, >> >> I'd like to jump in: Depending on the use case, I think I can >> absolutely make sense to work with the snapshot. The more feedback we >> get on potential errors, the more we'll be forced to keep it as stable >> as possible, and write more test cases ensuring it. Moreover, >> obviously, you'll always have access to the latest features. >> >> This is how your maven snippet needs to look like: >> >> <dependency> >> <groupId>org.basex</groupId> >> <artifactId>basex-api</artifactId> >> <version>8.0-SNAPSHOT</version> >> </dependency> >> >> Hope this helps, >> Christian >> >> >> On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote: >>> Hi Wendell, >>> >>> no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release: >>> >>> <dependency> >>> <groupId>org.basex</groupId> >>> <artifactId>basex-api</artifactId> >>> <version>7.9</version> >>> </dependency> >>> >>> >>> >>> >>> For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency: >>> >>> >>> <dependency> >>> <groupId>net.sf.saxon</groupId> >>> <artifactId>Saxon-HE</artifactId> >>> <version>SAXON-VERSION-YOU-LIKE</version> >>> </dependency> >>> >>> >>> Cheers, >>> Dirk >>> >>> >>> On 01/18/2015 10:29 PM, Wendell Piez wrote: >>>> BaseX friends, >>>> >>>> If I run BaseX from Maven, do I always get to use the latest BaseX? >>>> >>>> Do I have to do anything special to set up BaseX in Maven to use >>>> SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in >>>> my BaseX lib.) >>>> >>>> Thanks! Wendell >>>> >>>> >>> >>> -- >>> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de >>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>> > > > > -- > Wendell Piez | http://www.wendellpiez.com > XML | XSLT | electronic publishing > Eat Your Vegetables > _____oo_________o_o___ooooo____ooooooo_^
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
Hi Wendell,
If you believe you have found a good default setting, we invite you to contribute to our Wiki, e.g. our article on Maven [1], and add the missing pieces!
All the best, Christian
[1] http://docs.basex.org/wiki/Maven
On Sun, Feb 8, 2015 at 10:54 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Hi again Dirk,
This is excellent, thanks for helping me along here.
As for maven project setup, I am pretty certain that one of the shelf-standard archetypes would do just fine -- I just don't have enough experience in Java development to be able to make educated guess which one(s) would be best. Maybe I'll make some experiments. Of course in the scenario you are suggesting, any future users of my project would not have to do that for themselves, so stumbling forward may get me to the goal as quickly as "doing it right".
If/as I grope my way, I'll try to keep notes...
Cheers, Wendell
On Sun, Feb 8, 2015 at 5:34 AM, Dirk Kirsten dk@basex.org wrote:
Hello Wendell,
I guess you are correct and quite likely we should ship the archetype generators somehow, but I am personally am no Maven expert. Personally (and I think this is what everyone using Maven+BaseX is currently doing) I simply copy my default pom.xml to a new project.
Regarding your questions
- This is quite simple and the reason why Maven is quite nice. It is in fact as simple as including
<dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>9.6.0-4</version> </dependency>
into your pom.xml (of course you can change the Saxon version number)
The BaseX location is configurable in the jetty configuration in this setup. You can do this either in the jetty.xml file using
<Set name="host"><SystemProperty name="org.basex.dbpath" default="/your/db/path"/></Set>
or in the web.xml using
<context-param> <param-name>org.basex.dbpath</param-name> <param-value>your/db/path</param-value> </context-param>
The default is to use the data/ directory of the directory where the pom.xml file is located.
Happy to help and to answer more questions. Maybe we can actually use this and write down some Maven+BaseX Getting started guide in our documentation.
Cheers, Dirk On 02/07/2015 08:47 PM, Wendell Piez wrote:
Dear Dirk,
Thanks for all the input and advice! It is a great deal to digest, but I am sure I will figure it out.
My questions about which archetype to use stem from the fact that every How-to-start-with-Maven tutorial tells me to choose an archetype, and I simply don't know enough to guess how I would skip this step or follow it.
It is completely possible I have just chased myself into a rathole with this (in which case forgive me). I am sure the lightbulb will go on if I just persist.
However, your advice does raise a couple of other questions:
- My projects all require SaxonHE. BaseX is very good about using
SaxonHE if I put a copy of the Saxon .jar into BaseX itself -- as it will be presumably if I simply put saxon9he.jar on the classpath.
What do I do to get SaxonHE into BaseX under Maven? I can list it in the pom.xml - is it as simple as this? If this is the approach, then I guess I don't have to mess with its (or anyone's) .jar files? (which is the point of the exercise? :-)
- Where does BaseX store its databases when I run it under Maven?
I'm sure I'll have more questions. Thanks again.
Cheers, Wendell
On Thu, Feb 5, 2015 at 5:49 AM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
I have attached a sample pom.xml file. This should allow you to cover your two main use cases (at least, that is what I see here): 1) Starting a Jetty server, so you can run RestXQ and 2) Running BaseX standalone so you can e.g. run a script
Using the exec maven plugin you can run any java program from Maven. So this part
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>org.basex.BaseX</mainClass> <arguments> <argument>-q 4+2</argument> </arguments> </configuration> </plugin>
simply output 6 if run via
mvn exec:java
You can also override the arguments via command line like so
mvn exec:java -Dexec.args="-q 7+1"
Starting jetty can be done as usual running mvn jetty:run
I would recommend you have such a pom.xml file in each of your project directories. This allows you e.g. to use different BaseX versions for your different projects (your latest project might want to use our 8.0 snapshot, your potential high-security banking project in production most likely should not run unstable software) . In the pom.files you can also incorporate different JVM parameters (as I suggested before using export BASEX_JVM=-p=/my/restxq/directory && basexhttp, but this time using maven).
If you use Maven in general, it does not mean you have to compile anything at all. On the contrary, it allows programmers to fetch already compiled versions and fit them into their program.
I should not that you could also use a more complex Maven approach and use a parent pom.xml file and subprojects (we do this in the core BaseX files, as basex-core and basex-api are actually different projects, bundled together in a parent project). This is all Maven specific - Maven is a build system, sou basically you can do almost anything. Question is, how much you want to dive into Maven configuration or if it is good enough for you for now to simple have something you can share and others can check out easily.
If you have a project with such an pom.xml file and you share it e.g. via github, it should be enough for your users to check out the repository and run e.g. mvn jetty:run. Of course, you can then also write maven goals for repeating task, e.g. optimizing the database. So you than would have to write a simple mvn exec:optimize, which would call BaseX with the require parameters to do your optimization.
Of course, you could also do all this completely without Maven. You could also write custom shell scripts and automatically download BaseX, etc. pp. Essentially, Maven is just a tool which saves you same work and simplifies dependency-management.
Regarding the maven archetypes, I don't think we use them at all. I don't have much knowledge about them (also about Maven, I just use it as a tool, but I am always amazed how complex it is), but I guess we would have to write same sample archetypes for them - Which we didn't, as far as I know.
And sorry about being pedantic on using the mailing list. But I truly think many people stumble onto the problems faced with project setup and Maven usage, so I think these people can benefit.
I hope this helps.
Cheers Dirk
On 02/04/2015 06:52 PM, Wendell Piez wrote:
Hi again Christian and Dirk:
I should also mention - another goal for me is that things be self-contained enough that I can share the whole thing on github, like here:
https://github.com/wendellpiez/Luminescent
Of course this is a huge mess since it has been architected by accretion, but the idea is that I (or anyone) would be able to download the stuff and start playing as quickly as possible. Mind you, this is meant as a long-term backup and project management strategy for me as much as anything -- since the point is less the processing than the results. However, I am working on the assumption that any improvement for anyone is an improvement for myself.
I don't need to deliver BaseX to my user, but I would like to give users (my future self) an easy way to run BaseX with the necessary settings and resources available, to get my XSLT/XQuery-driven functionality onto their systems and screens as speedily as possible.
Thanks again, Wendell
On Wed, Feb 4, 2015 at 12:36 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian,
Absolutely, the BaseX wiki page helps.
The one thing I am stuck on is the selection of the Maven archetype. I vaguely get that it will generate a POM (an editable and extensible configuration file) and a subdirectory structure, wherein I can develop my BaseX application.
But *which* Maven archetype of the many available is the appropriate one for my needs ... I cannot pretend to know.
I do not, however, wish to compile BaseX locally -- or at least, that is not a goal. (As a means to an end I can be convinced it'd be okay.) I won't be extending or manipulating BaseX itself or writing any Java; all my code is XQuery and XSLT.
(Indeed, minimizing a dependency on BaseX -- maintaining the capability to use the same libraries in another framework or environment -- such as Apache Cocoon, XProc pipelines, eXist, MarkLogic, what have you -- is a strategic goal for me. BaseX's support of standards along with its ease of use is thus very important to me.)
Currently, I have everything running well from a single BaseX installation, without Maven (tweaking the RESTXQ directory setting to point it to my project). However, I have more than one project using BaseX, and wish to keep them independent.
I am considering Maven as a good way for me to set up and configure BaseX, with minimal overhead, in a portable and project-specific way, not to customize or compile it, but just to run it ... call a script to update a database, then call another to start the http server ...
But my goal would also be accomplished if I knew how to do something comparatively simple (or so I would think): start up BaseX to run with a project-specific runtime setting.
So Dirk suggests a script that runs
export BASEX_JVM=-p=/my/restxq/directory && basexhttp
which I could totally do, as soon as I upgrade BaseX to v8.0.
Or, if Maven is a simple, clean, and lightweight way to do it, I'm not opposed. It's how that would or could work (in specific) for me, that has me stumped. I can type mvn generate:archetype and then fake it, and I can edit the POM and sniff around in the directory structure ... feeling increasingly like a blind monkey, if you get my drift.
But Dirk urged that I help support other newbies by asking these questions in public, albeit they are slightly OT (Maven, Linux scripting), since they have to do with setting up and running BaseX ...
So what's the appropriate maven archetype for me given I wish to run BaseX but not compile any Java, per se?
Thanks! Wendell
On Wed, Feb 4, 2015 at 2:58 AM, Christian Grün christian.gruen@gmail.com wrote: > Hi Wendell, > >> For all us Maven innoscenti, I wonder if you could recommend which >> maven archetype one should use when getting started running BaseX? >> (Any guidance or resource appreciated.) > > I would like to redirect you to our Wiki documentation [1]. Does it > help, or do you think some essential information is missing here > (which we could/should add)? > > It's absolutely ok to run BaseX without Maven. The easiest thing is to > use the zip file and start "basexhttp" (see e.g. [2] for more > information). > > Best, > Christian > > [1] http://docs.basex.org/wiki/Maven > [2] http://docs.basex.org/wiki/Startup > > > On Tue, Feb 3, 2015 at 10:47 PM, Wendell Piez wapiez@wendellpiez.com wrote: >> Dear Christian and Dirk, >> >> >> I am guessing something with 'webapp' but I have no idea, I don't even >> know what "webapp" means in this context (although I think it may be >> what I want). >> >> Cordially, Wendell >> >> >> >> On Mon, Jan 19, 2015 at 1:55 AM, Christian Grün >> christian.gruen@gmail.com wrote: >>> Hi Wendell, hi Dirk, >>> >>> I'd like to jump in: Depending on the use case, I think I can >>> absolutely make sense to work with the snapshot. The more feedback we >>> get on potential errors, the more we'll be forced to keep it as stable >>> as possible, and write more test cases ensuring it. Moreover, >>> obviously, you'll always have access to the latest features. >>> >>> This is how your maven snippet needs to look like: >>> >>> <dependency> >>> <groupId>org.basex</groupId> >>> <artifactId>basex-api</artifactId> >>> <version>8.0-SNAPSHOT</version> >>> </dependency> >>> >>> Hope this helps, >>> Christian >>> >>> >>> On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote: >>>> Hi Wendell, >>>> >>>> no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release: >>>> >>>> <dependency> >>>> <groupId>org.basex</groupId> >>>> <artifactId>basex-api</artifactId> >>>> <version>7.9</version> >>>> </dependency> >>>> >>>> >>>> >>>> >>>> For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency: >>>> >>>> >>>> <dependency> >>>> <groupId>net.sf.saxon</groupId> >>>> <artifactId>Saxon-HE</artifactId> >>>> <version>SAXON-VERSION-YOU-LIKE</version> >>>> </dependency> >>>> >>>> >>>> Cheers, >>>> Dirk >>>> >>>> >>>> On 01/18/2015 10:29 PM, Wendell Piez wrote: >>>>> BaseX friends, >>>>> >>>>> If I run BaseX from Maven, do I always get to use the latest BaseX? >>>>> >>>>> Do I have to do anything special to set up BaseX in Maven to use >>>>> SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in >>>>> my BaseX lib.) >>>>> >>>>> Thanks! Wendell >>>>> >>>>> >>>> >>>> -- >>>> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de >>>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >>>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >>>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >>>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>>> >> >> >> >> -- >> Wendell Piez | http://www.wendellpiez.com >> XML | XSLT | electronic publishing >> Eat Your Vegetables >> _____oo_________o_o___ooooo____ooooooo_^
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
Christian,
You are very kind. I haven't got one yet -- but I'll let you know --
Cheers, Wendell
On Sun, Feb 8, 2015 at 5:24 PM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell,
If you believe you have found a good default setting, we invite you to contribute to our Wiki, e.g. our article on Maven [1], and add the missing pieces!
All the best, Christian
[1] http://docs.basex.org/wiki/Maven
On Sun, Feb 8, 2015 at 10:54 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Hi again Dirk,
This is excellent, thanks for helping me along here.
As for maven project setup, I am pretty certain that one of the shelf-standard archetypes would do just fine -- I just don't have enough experience in Java development to be able to make educated guess which one(s) would be best. Maybe I'll make some experiments. Of course in the scenario you are suggesting, any future users of my project would not have to do that for themselves, so stumbling forward may get me to the goal as quickly as "doing it right".
If/as I grope my way, I'll try to keep notes...
Cheers, Wendell
On Sun, Feb 8, 2015 at 5:34 AM, Dirk Kirsten dk@basex.org wrote:
Hello Wendell,
I guess you are correct and quite likely we should ship the archetype generators somehow, but I am personally am no Maven expert. Personally (and I think this is what everyone using Maven+BaseX is currently doing) I simply copy my default pom.xml to a new project.
Regarding your questions
- This is quite simple and the reason why Maven is quite nice. It is in fact as simple as including
<dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>9.6.0-4</version> </dependency>
into your pom.xml (of course you can change the Saxon version number)
The BaseX location is configurable in the jetty configuration in this setup. You can do this either in the jetty.xml file using
<Set name="host"><SystemProperty name="org.basex.dbpath" default="/your/db/path"/></Set>
or in the web.xml using
<context-param> <param-name>org.basex.dbpath</param-name> <param-value>your/db/path</param-value> </context-param>
The default is to use the data/ directory of the directory where the pom.xml file is located.
Happy to help and to answer more questions. Maybe we can actually use this and write down some Maven+BaseX Getting started guide in our documentation.
Cheers, Dirk On 02/07/2015 08:47 PM, Wendell Piez wrote:
Dear Dirk,
Thanks for all the input and advice! It is a great deal to digest, but I am sure I will figure it out.
My questions about which archetype to use stem from the fact that every How-to-start-with-Maven tutorial tells me to choose an archetype, and I simply don't know enough to guess how I would skip this step or follow it.
It is completely possible I have just chased myself into a rathole with this (in which case forgive me). I am sure the lightbulb will go on if I just persist.
However, your advice does raise a couple of other questions:
- My projects all require SaxonHE. BaseX is very good about using
SaxonHE if I put a copy of the Saxon .jar into BaseX itself -- as it will be presumably if I simply put saxon9he.jar on the classpath.
What do I do to get SaxonHE into BaseX under Maven? I can list it in the pom.xml - is it as simple as this? If this is the approach, then I guess I don't have to mess with its (or anyone's) .jar files? (which is the point of the exercise? :-)
- Where does BaseX store its databases when I run it under Maven?
I'm sure I'll have more questions. Thanks again.
Cheers, Wendell
On Thu, Feb 5, 2015 at 5:49 AM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
I have attached a sample pom.xml file. This should allow you to cover your two main use cases (at least, that is what I see here): 1) Starting a Jetty server, so you can run RestXQ and 2) Running BaseX standalone so you can e.g. run a script
Using the exec maven plugin you can run any java program from Maven. So this part
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>org.basex.BaseX</mainClass> <arguments> <argument>-q 4+2</argument> </arguments> </configuration> </plugin>
simply output 6 if run via
mvn exec:java
You can also override the arguments via command line like so
mvn exec:java -Dexec.args="-q 7+1"
Starting jetty can be done as usual running mvn jetty:run
I would recommend you have such a pom.xml file in each of your project directories. This allows you e.g. to use different BaseX versions for your different projects (your latest project might want to use our 8.0 snapshot, your potential high-security banking project in production most likely should not run unstable software) . In the pom.files you can also incorporate different JVM parameters (as I suggested before using export BASEX_JVM=-p=/my/restxq/directory && basexhttp, but this time using maven).
If you use Maven in general, it does not mean you have to compile anything at all. On the contrary, it allows programmers to fetch already compiled versions and fit them into their program.
I should not that you could also use a more complex Maven approach and use a parent pom.xml file and subprojects (we do this in the core BaseX files, as basex-core and basex-api are actually different projects, bundled together in a parent project). This is all Maven specific - Maven is a build system, sou basically you can do almost anything. Question is, how much you want to dive into Maven configuration or if it is good enough for you for now to simple have something you can share and others can check out easily.
If you have a project with such an pom.xml file and you share it e.g. via github, it should be enough for your users to check out the repository and run e.g. mvn jetty:run. Of course, you can then also write maven goals for repeating task, e.g. optimizing the database. So you than would have to write a simple mvn exec:optimize, which would call BaseX with the require parameters to do your optimization.
Of course, you could also do all this completely without Maven. You could also write custom shell scripts and automatically download BaseX, etc. pp. Essentially, Maven is just a tool which saves you same work and simplifies dependency-management.
Regarding the maven archetypes, I don't think we use them at all. I don't have much knowledge about them (also about Maven, I just use it as a tool, but I am always amazed how complex it is), but I guess we would have to write same sample archetypes for them - Which we didn't, as far as I know.
And sorry about being pedantic on using the mailing list. But I truly think many people stumble onto the problems faced with project setup and Maven usage, so I think these people can benefit.
I hope this helps.
Cheers Dirk
On 02/04/2015 06:52 PM, Wendell Piez wrote:
Hi again Christian and Dirk:
I should also mention - another goal for me is that things be self-contained enough that I can share the whole thing on github, like here:
https://github.com/wendellpiez/Luminescent
Of course this is a huge mess since it has been architected by accretion, but the idea is that I (or anyone) would be able to download the stuff and start playing as quickly as possible. Mind you, this is meant as a long-term backup and project management strategy for me as much as anything -- since the point is less the processing than the results. However, I am working on the assumption that any improvement for anyone is an improvement for myself.
I don't need to deliver BaseX to my user, but I would like to give users (my future self) an easy way to run BaseX with the necessary settings and resources available, to get my XSLT/XQuery-driven functionality onto their systems and screens as speedily as possible.
Thanks again, Wendell
On Wed, Feb 4, 2015 at 12:36 PM, Wendell Piez wapiez@wendellpiez.com wrote: > Dear Christian, > > Absolutely, the BaseX wiki page helps. > > The one thing I am stuck on is the selection of the Maven archetype. I > vaguely get that it will generate a POM (an editable and extensible > configuration file) and a subdirectory structure, wherein I can > develop my BaseX application. > > But *which* Maven archetype of the many available is the appropriate > one for my needs ... I cannot pretend to know. > > I do not, however, wish to compile BaseX locally -- or at least, that > is not a goal. (As a means to an end I can be convinced it'd be okay.) > I won't be extending or manipulating BaseX itself or writing any Java; > all my code is XQuery and XSLT. > > (Indeed, minimizing a dependency on BaseX -- maintaining the > capability to use the same libraries in another framework or > environment -- such as Apache Cocoon, XProc pipelines, eXist, > MarkLogic, what have you -- is a strategic goal for me. BaseX's > support of standards along with its ease of use is thus very important > to me.) > > Currently, I have everything running well from a single BaseX > installation, without Maven (tweaking the RESTXQ directory setting to > point it to my project). However, I have more than one project using > BaseX, and wish to keep them independent. > > I am considering Maven as a good way for me to set up and configure > BaseX, with minimal overhead, in a portable and project-specific way, > not to customize or compile it, but just to run it ... call a script > to update a database, then call another to start the http server ... > > But my goal would also be accomplished if I knew how to do something > comparatively simple (or so I would think): start up BaseX to run with > a project-specific runtime setting. > > So Dirk suggests a script that runs > > export BASEX_JVM=-p=/my/restxq/directory && basexhttp > > which I could totally do, as soon as I upgrade BaseX to v8.0. > > Or, if Maven is a simple, clean, and lightweight way to do it, I'm not > opposed. It's how that would or could work (in specific) for me, that > has me stumped. I can type mvn generate:archetype and then fake it, > and I can edit the POM and sniff around in the directory structure ... > feeling increasingly like a blind monkey, if you get my drift. > > But Dirk urged that I help support other newbies by asking these > questions in public, albeit they are slightly OT (Maven, Linux > scripting), since they have to do with setting up and running BaseX > ... > > So what's the appropriate maven archetype for me given I wish to run > BaseX but not compile any Java, per se? > > Thanks! > Wendell > > > On Wed, Feb 4, 2015 at 2:58 AM, Christian Grün > christian.gruen@gmail.com wrote: >> Hi Wendell, >> >>> For all us Maven innoscenti, I wonder if you could recommend which >>> maven archetype one should use when getting started running BaseX? >>> (Any guidance or resource appreciated.) >> >> I would like to redirect you to our Wiki documentation [1]. Does it >> help, or do you think some essential information is missing here >> (which we could/should add)? >> >> It's absolutely ok to run BaseX without Maven. The easiest thing is to >> use the zip file and start "basexhttp" (see e.g. [2] for more >> information). >> >> Best, >> Christian >> >> [1] http://docs.basex.org/wiki/Maven >> [2] http://docs.basex.org/wiki/Startup >> >> >> On Tue, Feb 3, 2015 at 10:47 PM, Wendell Piez wapiez@wendellpiez.com wrote: >>> Dear Christian and Dirk, >>> >>> >>> I am guessing something with 'webapp' but I have no idea, I don't even >>> know what "webapp" means in this context (although I think it may be >>> what I want). >>> >>> Cordially, Wendell >>> >>> >>> >>> On Mon, Jan 19, 2015 at 1:55 AM, Christian Grün >>> christian.gruen@gmail.com wrote: >>>> Hi Wendell, hi Dirk, >>>> >>>> I'd like to jump in: Depending on the use case, I think I can >>>> absolutely make sense to work with the snapshot. The more feedback we >>>> get on potential errors, the more we'll be forced to keep it as stable >>>> as possible, and write more test cases ensuring it. Moreover, >>>> obviously, you'll always have access to the latest features. >>>> >>>> This is how your maven snippet needs to look like: >>>> >>>> <dependency> >>>> <groupId>org.basex</groupId> >>>> <artifactId>basex-api</artifactId> >>>> <version>8.0-SNAPSHOT</version> >>>> </dependency> >>>> >>>> Hope this helps, >>>> Christian >>>> >>>> >>>> On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote: >>>>> Hi Wendell, >>>>> >>>>> no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release: >>>>> >>>>> <dependency> >>>>> <groupId>org.basex</groupId> >>>>> <artifactId>basex-api</artifactId> >>>>> <version>7.9</version> >>>>> </dependency> >>>>> >>>>> >>>>> >>>>> >>>>> For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency: >>>>> >>>>> >>>>> <dependency> >>>>> <groupId>net.sf.saxon</groupId> >>>>> <artifactId>Saxon-HE</artifactId> >>>>> <version>SAXON-VERSION-YOU-LIKE</version> >>>>> </dependency> >>>>> >>>>> >>>>> Cheers, >>>>> Dirk >>>>> >>>>> >>>>> On 01/18/2015 10:29 PM, Wendell Piez wrote: >>>>>> BaseX friends, >>>>>> >>>>>> If I run BaseX from Maven, do I always get to use the latest BaseX? >>>>>> >>>>>> Do I have to do anything special to set up BaseX in Maven to use >>>>>> SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in >>>>>> my BaseX lib.) >>>>>> >>>>>> Thanks! Wendell >>>>>> >>>>>> >>>>> >>>>> -- >>>>> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de >>>>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >>>>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >>>>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >>>>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>>>> >>> >>> >>> >>> -- >>> Wendell Piez | http://www.wendellpiez.com >>> XML | XSLT | electronic publishing >>> Eat Your Vegetables >>> _____oo_________o_o___ooooo____ooooooo_^ > > > > -- > Wendell Piez | http://www.wendellpiez.com > XML | XSLT | electronic publishing > Eat Your Vegetables > _____oo_________o_o___ooooo____ooooooo_^
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
Hi again Dirk and Christian,
So would I also be able to start the BaseX GUI using Maven? Is this something I might (or might not) particularly wish to do, i.e. a bad or perhaps not so bad idea?
Thanks, Wendell
On Sun, Feb 8, 2015 at 5:34 AM, Dirk Kirsten dk@basex.org wrote:
Hello Wendell,
I guess you are correct and quite likely we should ship the archetype generators somehow, but I am personally am no Maven expert. Personally (and I think this is what everyone using Maven+BaseX is currently doing) I simply copy my default pom.xml to a new project.
Regarding your questions
- This is quite simple and the reason why Maven is quite nice. It is in fact as simple as including
<dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>9.6.0-4</version> </dependency>
into your pom.xml (of course you can change the Saxon version number)
The BaseX location is configurable in the jetty configuration in this setup. You can do this either in the jetty.xml file using
<Set name="host"><SystemProperty name="org.basex.dbpath" default="/your/db/path"/></Set>
or in the web.xml using
<context-param> <param-name>org.basex.dbpath</param-name> <param-value>your/db/path</param-value> </context-param>
The default is to use the data/ directory of the directory where the pom.xml file is located.
Happy to help and to answer more questions. Maybe we can actually use this and write down some Maven+BaseX Getting started guide in our documentation.
Cheers, Dirk On 02/07/2015 08:47 PM, Wendell Piez wrote:
Dear Dirk,
Thanks for all the input and advice! It is a great deal to digest, but I am sure I will figure it out.
My questions about which archetype to use stem from the fact that every How-to-start-with-Maven tutorial tells me to choose an archetype, and I simply don't know enough to guess how I would skip this step or follow it.
It is completely possible I have just chased myself into a rathole with this (in which case forgive me). I am sure the lightbulb will go on if I just persist.
However, your advice does raise a couple of other questions:
- My projects all require SaxonHE. BaseX is very good about using
SaxonHE if I put a copy of the Saxon .jar into BaseX itself -- as it will be presumably if I simply put saxon9he.jar on the classpath.
What do I do to get SaxonHE into BaseX under Maven? I can list it in the pom.xml - is it as simple as this? If this is the approach, then I guess I don't have to mess with its (or anyone's) .jar files? (which is the point of the exercise? :-)
- Where does BaseX store its databases when I run it under Maven?
I'm sure I'll have more questions. Thanks again.
Cheers, Wendell
On Thu, Feb 5, 2015 at 5:49 AM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
I have attached a sample pom.xml file. This should allow you to cover your two main use cases (at least, that is what I see here): 1) Starting a Jetty server, so you can run RestXQ and 2) Running BaseX standalone so you can e.g. run a script
Using the exec maven plugin you can run any java program from Maven. So this part
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>org.basex.BaseX</mainClass> <arguments> <argument>-q 4+2</argument> </arguments> </configuration> </plugin>
simply output 6 if run via
mvn exec:java
You can also override the arguments via command line like so
mvn exec:java -Dexec.args="-q 7+1"
Starting jetty can be done as usual running mvn jetty:run
I would recommend you have such a pom.xml file in each of your project directories. This allows you e.g. to use different BaseX versions for your different projects (your latest project might want to use our 8.0 snapshot, your potential high-security banking project in production most likely should not run unstable software) . In the pom.files you can also incorporate different JVM parameters (as I suggested before using export BASEX_JVM=-p=/my/restxq/directory && basexhttp, but this time using maven).
If you use Maven in general, it does not mean you have to compile anything at all. On the contrary, it allows programmers to fetch already compiled versions and fit them into their program.
I should not that you could also use a more complex Maven approach and use a parent pom.xml file and subprojects (we do this in the core BaseX files, as basex-core and basex-api are actually different projects, bundled together in a parent project). This is all Maven specific - Maven is a build system, sou basically you can do almost anything. Question is, how much you want to dive into Maven configuration or if it is good enough for you for now to simple have something you can share and others can check out easily.
If you have a project with such an pom.xml file and you share it e.g. via github, it should be enough for your users to check out the repository and run e.g. mvn jetty:run. Of course, you can then also write maven goals for repeating task, e.g. optimizing the database. So you than would have to write a simple mvn exec:optimize, which would call BaseX with the require parameters to do your optimization.
Of course, you could also do all this completely without Maven. You could also write custom shell scripts and automatically download BaseX, etc. pp. Essentially, Maven is just a tool which saves you same work and simplifies dependency-management.
Regarding the maven archetypes, I don't think we use them at all. I don't have much knowledge about them (also about Maven, I just use it as a tool, but I am always amazed how complex it is), but I guess we would have to write same sample archetypes for them - Which we didn't, as far as I know.
And sorry about being pedantic on using the mailing list. But I truly think many people stumble onto the problems faced with project setup and Maven usage, so I think these people can benefit.
I hope this helps.
Cheers Dirk
On 02/04/2015 06:52 PM, Wendell Piez wrote:
Hi again Christian and Dirk:
I should also mention - another goal for me is that things be self-contained enough that I can share the whole thing on github, like here:
https://github.com/wendellpiez/Luminescent
Of course this is a huge mess since it has been architected by accretion, but the idea is that I (or anyone) would be able to download the stuff and start playing as quickly as possible. Mind you, this is meant as a long-term backup and project management strategy for me as much as anything -- since the point is less the processing than the results. However, I am working on the assumption that any improvement for anyone is an improvement for myself.
I don't need to deliver BaseX to my user, but I would like to give users (my future self) an easy way to run BaseX with the necessary settings and resources available, to get my XSLT/XQuery-driven functionality onto their systems and screens as speedily as possible.
Thanks again, Wendell
On Wed, Feb 4, 2015 at 12:36 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian,
Absolutely, the BaseX wiki page helps.
The one thing I am stuck on is the selection of the Maven archetype. I vaguely get that it will generate a POM (an editable and extensible configuration file) and a subdirectory structure, wherein I can develop my BaseX application.
But *which* Maven archetype of the many available is the appropriate one for my needs ... I cannot pretend to know.
I do not, however, wish to compile BaseX locally -- or at least, that is not a goal. (As a means to an end I can be convinced it'd be okay.) I won't be extending or manipulating BaseX itself or writing any Java; all my code is XQuery and XSLT.
(Indeed, minimizing a dependency on BaseX -- maintaining the capability to use the same libraries in another framework or environment -- such as Apache Cocoon, XProc pipelines, eXist, MarkLogic, what have you -- is a strategic goal for me. BaseX's support of standards along with its ease of use is thus very important to me.)
Currently, I have everything running well from a single BaseX installation, without Maven (tweaking the RESTXQ directory setting to point it to my project). However, I have more than one project using BaseX, and wish to keep them independent.
I am considering Maven as a good way for me to set up and configure BaseX, with minimal overhead, in a portable and project-specific way, not to customize or compile it, but just to run it ... call a script to update a database, then call another to start the http server ...
But my goal would also be accomplished if I knew how to do something comparatively simple (or so I would think): start up BaseX to run with a project-specific runtime setting.
So Dirk suggests a script that runs
export BASEX_JVM=-p=/my/restxq/directory && basexhttp
which I could totally do, as soon as I upgrade BaseX to v8.0.
Or, if Maven is a simple, clean, and lightweight way to do it, I'm not opposed. It's how that would or could work (in specific) for me, that has me stumped. I can type mvn generate:archetype and then fake it, and I can edit the POM and sniff around in the directory structure ... feeling increasingly like a blind monkey, if you get my drift.
But Dirk urged that I help support other newbies by asking these questions in public, albeit they are slightly OT (Maven, Linux scripting), since they have to do with setting up and running BaseX ...
So what's the appropriate maven archetype for me given I wish to run BaseX but not compile any Java, per se?
Thanks! Wendell
On Wed, Feb 4, 2015 at 2:58 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell,
> For all us Maven innoscenti, I wonder if you could recommend which > maven archetype one should use when getting started running BaseX? > (Any guidance or resource appreciated.)
I would like to redirect you to our Wiki documentation [1]. Does it help, or do you think some essential information is missing here (which we could/should add)?
It's absolutely ok to run BaseX without Maven. The easiest thing is to use the zip file and start "basexhttp" (see e.g. [2] for more information).
Best, Christian
[1] http://docs.basex.org/wiki/Maven [2] http://docs.basex.org/wiki/Startup
On Tue, Feb 3, 2015 at 10:47 PM, Wendell Piez wapiez@wendellpiez.com wrote: > Dear Christian and Dirk, > > > I am guessing something with 'webapp' but I have no idea, I don't even > know what "webapp" means in this context (although I think it may be > what I want). > > Cordially, Wendell > > > > On Mon, Jan 19, 2015 at 1:55 AM, Christian Grün > christian.gruen@gmail.com wrote: >> Hi Wendell, hi Dirk, >> >> I'd like to jump in: Depending on the use case, I think I can >> absolutely make sense to work with the snapshot. The more feedback we >> get on potential errors, the more we'll be forced to keep it as stable >> as possible, and write more test cases ensuring it. Moreover, >> obviously, you'll always have access to the latest features. >> >> This is how your maven snippet needs to look like: >> >> <dependency> >> <groupId>org.basex</groupId> >> <artifactId>basex-api</artifactId> >> <version>8.0-SNAPSHOT</version> >> </dependency> >> >> Hope this helps, >> Christian >> >> >> On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote: >>> Hi Wendell, >>> >>> no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release: >>> >>> <dependency> >>> <groupId>org.basex</groupId> >>> <artifactId>basex-api</artifactId> >>> <version>7.9</version> >>> </dependency> >>> >>> >>> >>> >>> For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency: >>> >>> >>> <dependency> >>> <groupId>net.sf.saxon</groupId> >>> <artifactId>Saxon-HE</artifactId> >>> <version>SAXON-VERSION-YOU-LIKE</version> >>> </dependency> >>> >>> >>> Cheers, >>> Dirk >>> >>> >>> On 01/18/2015 10:29 PM, Wendell Piez wrote: >>>> BaseX friends, >>>> >>>> If I run BaseX from Maven, do I always get to use the latest BaseX? >>>> >>>> Do I have to do anything special to set up BaseX in Maven to use >>>> SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in >>>> my BaseX lib.) >>>> >>>> Thanks! Wendell >>>> >>>> >>> >>> -- >>> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de >>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>> > > > > -- > Wendell Piez | http://www.wendellpiez.com > XML | XSLT | electronic publishing > Eat Your Vegetables > _____oo_________o_o___ooooo____ooooooo_^
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
Hi Wendell,
I haven't done this by myself (personally, I tend to work with the start scripts), but if you decide to do everything with Maven, it's surely an option to do so!
Cheers, Christian
On Wed, Feb 11, 2015 at 7:28 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Hi again Dirk and Christian,
So would I also be able to start the BaseX GUI using Maven? Is this something I might (or might not) particularly wish to do, i.e. a bad or perhaps not so bad idea?
Thanks, Wendell
On Sun, Feb 8, 2015 at 5:34 AM, Dirk Kirsten dk@basex.org wrote:
Hello Wendell,
I guess you are correct and quite likely we should ship the archetype generators somehow, but I am personally am no Maven expert. Personally (and I think this is what everyone using Maven+BaseX is currently doing) I simply copy my default pom.xml to a new project.
Regarding your questions
- This is quite simple and the reason why Maven is quite nice. It is in fact as simple as including
<dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>9.6.0-4</version> </dependency>
into your pom.xml (of course you can change the Saxon version number)
The BaseX location is configurable in the jetty configuration in this setup. You can do this either in the jetty.xml file using
<Set name="host"><SystemProperty name="org.basex.dbpath" default="/your/db/path"/></Set>
or in the web.xml using
<context-param> <param-name>org.basex.dbpath</param-name> <param-value>your/db/path</param-value> </context-param>
The default is to use the data/ directory of the directory where the pom.xml file is located.
Happy to help and to answer more questions. Maybe we can actually use this and write down some Maven+BaseX Getting started guide in our documentation.
Cheers, Dirk On 02/07/2015 08:47 PM, Wendell Piez wrote:
Dear Dirk,
Thanks for all the input and advice! It is a great deal to digest, but I am sure I will figure it out.
My questions about which archetype to use stem from the fact that every How-to-start-with-Maven tutorial tells me to choose an archetype, and I simply don't know enough to guess how I would skip this step or follow it.
It is completely possible I have just chased myself into a rathole with this (in which case forgive me). I am sure the lightbulb will go on if I just persist.
However, your advice does raise a couple of other questions:
- My projects all require SaxonHE. BaseX is very good about using
SaxonHE if I put a copy of the Saxon .jar into BaseX itself -- as it will be presumably if I simply put saxon9he.jar on the classpath.
What do I do to get SaxonHE into BaseX under Maven? I can list it in the pom.xml - is it as simple as this? If this is the approach, then I guess I don't have to mess with its (or anyone's) .jar files? (which is the point of the exercise? :-)
- Where does BaseX store its databases when I run it under Maven?
I'm sure I'll have more questions. Thanks again.
Cheers, Wendell
On Thu, Feb 5, 2015 at 5:49 AM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
I have attached a sample pom.xml file. This should allow you to cover your two main use cases (at least, that is what I see here): 1) Starting a Jetty server, so you can run RestXQ and 2) Running BaseX standalone so you can e.g. run a script
Using the exec maven plugin you can run any java program from Maven. So this part
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>org.basex.BaseX</mainClass> <arguments> <argument>-q 4+2</argument> </arguments> </configuration> </plugin>
simply output 6 if run via
mvn exec:java
You can also override the arguments via command line like so
mvn exec:java -Dexec.args="-q 7+1"
Starting jetty can be done as usual running mvn jetty:run
I would recommend you have such a pom.xml file in each of your project directories. This allows you e.g. to use different BaseX versions for your different projects (your latest project might want to use our 8.0 snapshot, your potential high-security banking project in production most likely should not run unstable software) . In the pom.files you can also incorporate different JVM parameters (as I suggested before using export BASEX_JVM=-p=/my/restxq/directory && basexhttp, but this time using maven).
If you use Maven in general, it does not mean you have to compile anything at all. On the contrary, it allows programmers to fetch already compiled versions and fit them into their program.
I should not that you could also use a more complex Maven approach and use a parent pom.xml file and subprojects (we do this in the core BaseX files, as basex-core and basex-api are actually different projects, bundled together in a parent project). This is all Maven specific - Maven is a build system, sou basically you can do almost anything. Question is, how much you want to dive into Maven configuration or if it is good enough for you for now to simple have something you can share and others can check out easily.
If you have a project with such an pom.xml file and you share it e.g. via github, it should be enough for your users to check out the repository and run e.g. mvn jetty:run. Of course, you can then also write maven goals for repeating task, e.g. optimizing the database. So you than would have to write a simple mvn exec:optimize, which would call BaseX with the require parameters to do your optimization.
Of course, you could also do all this completely without Maven. You could also write custom shell scripts and automatically download BaseX, etc. pp. Essentially, Maven is just a tool which saves you same work and simplifies dependency-management.
Regarding the maven archetypes, I don't think we use them at all. I don't have much knowledge about them (also about Maven, I just use it as a tool, but I am always amazed how complex it is), but I guess we would have to write same sample archetypes for them - Which we didn't, as far as I know.
And sorry about being pedantic on using the mailing list. But I truly think many people stumble onto the problems faced with project setup and Maven usage, so I think these people can benefit.
I hope this helps.
Cheers Dirk
On 02/04/2015 06:52 PM, Wendell Piez wrote:
Hi again Christian and Dirk:
I should also mention - another goal for me is that things be self-contained enough that I can share the whole thing on github, like here:
https://github.com/wendellpiez/Luminescent
Of course this is a huge mess since it has been architected by accretion, but the idea is that I (or anyone) would be able to download the stuff and start playing as quickly as possible. Mind you, this is meant as a long-term backup and project management strategy for me as much as anything -- since the point is less the processing than the results. However, I am working on the assumption that any improvement for anyone is an improvement for myself.
I don't need to deliver BaseX to my user, but I would like to give users (my future self) an easy way to run BaseX with the necessary settings and resources available, to get my XSLT/XQuery-driven functionality onto their systems and screens as speedily as possible.
Thanks again, Wendell
On Wed, Feb 4, 2015 at 12:36 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian,
Absolutely, the BaseX wiki page helps.
The one thing I am stuck on is the selection of the Maven archetype. I vaguely get that it will generate a POM (an editable and extensible configuration file) and a subdirectory structure, wherein I can develop my BaseX application.
But *which* Maven archetype of the many available is the appropriate one for my needs ... I cannot pretend to know.
I do not, however, wish to compile BaseX locally -- or at least, that is not a goal. (As a means to an end I can be convinced it'd be okay.) I won't be extending or manipulating BaseX itself or writing any Java; all my code is XQuery and XSLT.
(Indeed, minimizing a dependency on BaseX -- maintaining the capability to use the same libraries in another framework or environment -- such as Apache Cocoon, XProc pipelines, eXist, MarkLogic, what have you -- is a strategic goal for me. BaseX's support of standards along with its ease of use is thus very important to me.)
Currently, I have everything running well from a single BaseX installation, without Maven (tweaking the RESTXQ directory setting to point it to my project). However, I have more than one project using BaseX, and wish to keep them independent.
I am considering Maven as a good way for me to set up and configure BaseX, with minimal overhead, in a portable and project-specific way, not to customize or compile it, but just to run it ... call a script to update a database, then call another to start the http server ...
But my goal would also be accomplished if I knew how to do something comparatively simple (or so I would think): start up BaseX to run with a project-specific runtime setting.
So Dirk suggests a script that runs
export BASEX_JVM=-p=/my/restxq/directory && basexhttp
which I could totally do, as soon as I upgrade BaseX to v8.0.
Or, if Maven is a simple, clean, and lightweight way to do it, I'm not opposed. It's how that would or could work (in specific) for me, that has me stumped. I can type mvn generate:archetype and then fake it, and I can edit the POM and sniff around in the directory structure ... feeling increasingly like a blind monkey, if you get my drift.
But Dirk urged that I help support other newbies by asking these questions in public, albeit they are slightly OT (Maven, Linux scripting), since they have to do with setting up and running BaseX ...
So what's the appropriate maven archetype for me given I wish to run BaseX but not compile any Java, per se?
Thanks! Wendell
On Wed, Feb 4, 2015 at 2:58 AM, Christian Grün christian.gruen@gmail.com wrote: > Hi Wendell, > >> For all us Maven innoscenti, I wonder if you could recommend which >> maven archetype one should use when getting started running BaseX? >> (Any guidance or resource appreciated.) > > I would like to redirect you to our Wiki documentation [1]. Does it > help, or do you think some essential information is missing here > (which we could/should add)? > > It's absolutely ok to run BaseX without Maven. The easiest thing is to > use the zip file and start "basexhttp" (see e.g. [2] for more > information). > > Best, > Christian > > [1] http://docs.basex.org/wiki/Maven > [2] http://docs.basex.org/wiki/Startup > > > On Tue, Feb 3, 2015 at 10:47 PM, Wendell Piez wapiez@wendellpiez.com wrote: >> Dear Christian and Dirk, >> >> >> I am guessing something with 'webapp' but I have no idea, I don't even >> know what "webapp" means in this context (although I think it may be >> what I want). >> >> Cordially, Wendell >> >> >> >> On Mon, Jan 19, 2015 at 1:55 AM, Christian Grün >> christian.gruen@gmail.com wrote: >>> Hi Wendell, hi Dirk, >>> >>> I'd like to jump in: Depending on the use case, I think I can >>> absolutely make sense to work with the snapshot. The more feedback we >>> get on potential errors, the more we'll be forced to keep it as stable >>> as possible, and write more test cases ensuring it. Moreover, >>> obviously, you'll always have access to the latest features. >>> >>> This is how your maven snippet needs to look like: >>> >>> <dependency> >>> <groupId>org.basex</groupId> >>> <artifactId>basex-api</artifactId> >>> <version>8.0-SNAPSHOT</version> >>> </dependency> >>> >>> Hope this helps, >>> Christian >>> >>> >>> On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote: >>>> Hi Wendell, >>>> >>>> no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release: >>>> >>>> <dependency> >>>> <groupId>org.basex</groupId> >>>> <artifactId>basex-api</artifactId> >>>> <version>7.9</version> >>>> </dependency> >>>> >>>> >>>> >>>> >>>> For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency: >>>> >>>> >>>> <dependency> >>>> <groupId>net.sf.saxon</groupId> >>>> <artifactId>Saxon-HE</artifactId> >>>> <version>SAXON-VERSION-YOU-LIKE</version> >>>> </dependency> >>>> >>>> >>>> Cheers, >>>> Dirk >>>> >>>> >>>> On 01/18/2015 10:29 PM, Wendell Piez wrote: >>>>> BaseX friends, >>>>> >>>>> If I run BaseX from Maven, do I always get to use the latest BaseX? >>>>> >>>>> Do I have to do anything special to set up BaseX in Maven to use >>>>> SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in >>>>> my BaseX lib.) >>>>> >>>>> Thanks! Wendell >>>>> >>>>> >>>> >>>> -- >>>> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de >>>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >>>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >>>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >>>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>>> >> >> >> >> -- >> Wendell Piez | http://www.wendellpiez.com >> XML | XSLT | electronic publishing >> Eat Your Vegetables >> _____oo_________o_o___ooooo____ooooooo_^
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
Christian, thanks!
(Dirk, can you offer any hint as to how a maven plugin-or-whatnot could set up to start the BaseX GUI? Or should I simply mess around till this pops out? Christian doesn't seem to think this is prima facie a bad idea....)
Thanks! Wendell
On Wed, Feb 11, 2015 at 1:31 PM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell,
I haven't done this by myself (personally, I tend to work with the start scripts), but if you decide to do everything with Maven, it's surely an option to do so!
Cheers, Christian
On Wed, Feb 11, 2015 at 7:28 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Hi again Dirk and Christian,
So would I also be able to start the BaseX GUI using Maven? Is this something I might (or might not) particularly wish to do, i.e. a bad or perhaps not so bad idea?
Thanks, Wendell
On Sun, Feb 8, 2015 at 5:34 AM, Dirk Kirsten dk@basex.org wrote:
Hello Wendell,
I guess you are correct and quite likely we should ship the archetype generators somehow, but I am personally am no Maven expert. Personally (and I think this is what everyone using Maven+BaseX is currently doing) I simply copy my default pom.xml to a new project.
Regarding your questions
- This is quite simple and the reason why Maven is quite nice. It is in fact as simple as including
<dependency> <groupId>net.sf.saxon</groupId> <artifactId>Saxon-HE</artifactId> <version>9.6.0-4</version> </dependency>
into your pom.xml (of course you can change the Saxon version number)
The BaseX location is configurable in the jetty configuration in this setup. You can do this either in the jetty.xml file using
<Set name="host"><SystemProperty name="org.basex.dbpath" default="/your/db/path"/></Set>
or in the web.xml using
<context-param> <param-name>org.basex.dbpath</param-name> <param-value>your/db/path</param-value> </context-param>
The default is to use the data/ directory of the directory where the pom.xml file is located.
Happy to help and to answer more questions. Maybe we can actually use this and write down some Maven+BaseX Getting started guide in our documentation.
Cheers, Dirk On 02/07/2015 08:47 PM, Wendell Piez wrote:
Dear Dirk,
Thanks for all the input and advice! It is a great deal to digest, but I am sure I will figure it out.
My questions about which archetype to use stem from the fact that every How-to-start-with-Maven tutorial tells me to choose an archetype, and I simply don't know enough to guess how I would skip this step or follow it.
It is completely possible I have just chased myself into a rathole with this (in which case forgive me). I am sure the lightbulb will go on if I just persist.
However, your advice does raise a couple of other questions:
- My projects all require SaxonHE. BaseX is very good about using
SaxonHE if I put a copy of the Saxon .jar into BaseX itself -- as it will be presumably if I simply put saxon9he.jar on the classpath.
What do I do to get SaxonHE into BaseX under Maven? I can list it in the pom.xml - is it as simple as this? If this is the approach, then I guess I don't have to mess with its (or anyone's) .jar files? (which is the point of the exercise? :-)
- Where does BaseX store its databases when I run it under Maven?
I'm sure I'll have more questions. Thanks again.
Cheers, Wendell
On Thu, Feb 5, 2015 at 5:49 AM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
I have attached a sample pom.xml file. This should allow you to cover your two main use cases (at least, that is what I see here): 1) Starting a Jetty server, so you can run RestXQ and 2) Running BaseX standalone so you can e.g. run a script
Using the exec maven plugin you can run any java program from Maven. So this part
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>org.basex.BaseX</mainClass> <arguments> <argument>-q 4+2</argument> </arguments> </configuration> </plugin>
simply output 6 if run via
mvn exec:java
You can also override the arguments via command line like so
mvn exec:java -Dexec.args="-q 7+1"
Starting jetty can be done as usual running mvn jetty:run
I would recommend you have such a pom.xml file in each of your project directories. This allows you e.g. to use different BaseX versions for your different projects (your latest project might want to use our 8.0 snapshot, your potential high-security banking project in production most likely should not run unstable software) . In the pom.files you can also incorporate different JVM parameters (as I suggested before using export BASEX_JVM=-p=/my/restxq/directory && basexhttp, but this time using maven).
If you use Maven in general, it does not mean you have to compile anything at all. On the contrary, it allows programmers to fetch already compiled versions and fit them into their program.
I should not that you could also use a more complex Maven approach and use a parent pom.xml file and subprojects (we do this in the core BaseX files, as basex-core and basex-api are actually different projects, bundled together in a parent project). This is all Maven specific - Maven is a build system, sou basically you can do almost anything. Question is, how much you want to dive into Maven configuration or if it is good enough for you for now to simple have something you can share and others can check out easily.
If you have a project with such an pom.xml file and you share it e.g. via github, it should be enough for your users to check out the repository and run e.g. mvn jetty:run. Of course, you can then also write maven goals for repeating task, e.g. optimizing the database. So you than would have to write a simple mvn exec:optimize, which would call BaseX with the require parameters to do your optimization.
Of course, you could also do all this completely without Maven. You could also write custom shell scripts and automatically download BaseX, etc. pp. Essentially, Maven is just a tool which saves you same work and simplifies dependency-management.
Regarding the maven archetypes, I don't think we use them at all. I don't have much knowledge about them (also about Maven, I just use it as a tool, but I am always amazed how complex it is), but I guess we would have to write same sample archetypes for them - Which we didn't, as far as I know.
And sorry about being pedantic on using the mailing list. But I truly think many people stumble onto the problems faced with project setup and Maven usage, so I think these people can benefit.
I hope this helps.
Cheers Dirk
On 02/04/2015 06:52 PM, Wendell Piez wrote:
Hi again Christian and Dirk:
I should also mention - another goal for me is that things be self-contained enough that I can share the whole thing on github, like here:
https://github.com/wendellpiez/Luminescent
Of course this is a huge mess since it has been architected by accretion, but the idea is that I (or anyone) would be able to download the stuff and start playing as quickly as possible. Mind you, this is meant as a long-term backup and project management strategy for me as much as anything -- since the point is less the processing than the results. However, I am working on the assumption that any improvement for anyone is an improvement for myself.
I don't need to deliver BaseX to my user, but I would like to give users (my future self) an easy way to run BaseX with the necessary settings and resources available, to get my XSLT/XQuery-driven functionality onto their systems and screens as speedily as possible.
Thanks again, Wendell
On Wed, Feb 4, 2015 at 12:36 PM, Wendell Piez wapiez@wendellpiez.com wrote: > Dear Christian, > > Absolutely, the BaseX wiki page helps. > > The one thing I am stuck on is the selection of the Maven archetype. I > vaguely get that it will generate a POM (an editable and extensible > configuration file) and a subdirectory structure, wherein I can > develop my BaseX application. > > But *which* Maven archetype of the many available is the appropriate > one for my needs ... I cannot pretend to know. > > I do not, however, wish to compile BaseX locally -- or at least, that > is not a goal. (As a means to an end I can be convinced it'd be okay.) > I won't be extending or manipulating BaseX itself or writing any Java; > all my code is XQuery and XSLT. > > (Indeed, minimizing a dependency on BaseX -- maintaining the > capability to use the same libraries in another framework or > environment -- such as Apache Cocoon, XProc pipelines, eXist, > MarkLogic, what have you -- is a strategic goal for me. BaseX's > support of standards along with its ease of use is thus very important > to me.) > > Currently, I have everything running well from a single BaseX > installation, without Maven (tweaking the RESTXQ directory setting to > point it to my project). However, I have more than one project using > BaseX, and wish to keep them independent. > > I am considering Maven as a good way for me to set up and configure > BaseX, with minimal overhead, in a portable and project-specific way, > not to customize or compile it, but just to run it ... call a script > to update a database, then call another to start the http server ... > > But my goal would also be accomplished if I knew how to do something > comparatively simple (or so I would think): start up BaseX to run with > a project-specific runtime setting. > > So Dirk suggests a script that runs > > export BASEX_JVM=-p=/my/restxq/directory && basexhttp > > which I could totally do, as soon as I upgrade BaseX to v8.0. > > Or, if Maven is a simple, clean, and lightweight way to do it, I'm not > opposed. It's how that would or could work (in specific) for me, that > has me stumped. I can type mvn generate:archetype and then fake it, > and I can edit the POM and sniff around in the directory structure ... > feeling increasingly like a blind monkey, if you get my drift. > > But Dirk urged that I help support other newbies by asking these > questions in public, albeit they are slightly OT (Maven, Linux > scripting), since they have to do with setting up and running BaseX > ... > > So what's the appropriate maven archetype for me given I wish to run > BaseX but not compile any Java, per se? > > Thanks! > Wendell > > > On Wed, Feb 4, 2015 at 2:58 AM, Christian Grün > christian.gruen@gmail.com wrote: >> Hi Wendell, >> >>> For all us Maven innoscenti, I wonder if you could recommend which >>> maven archetype one should use when getting started running BaseX? >>> (Any guidance or resource appreciated.) >> >> I would like to redirect you to our Wiki documentation [1]. Does it >> help, or do you think some essential information is missing here >> (which we could/should add)? >> >> It's absolutely ok to run BaseX without Maven. The easiest thing is to >> use the zip file and start "basexhttp" (see e.g. [2] for more >> information). >> >> Best, >> Christian >> >> [1] http://docs.basex.org/wiki/Maven >> [2] http://docs.basex.org/wiki/Startup >> >> >> On Tue, Feb 3, 2015 at 10:47 PM, Wendell Piez wapiez@wendellpiez.com wrote: >>> Dear Christian and Dirk, >>> >>> >>> I am guessing something with 'webapp' but I have no idea, I don't even >>> know what "webapp" means in this context (although I think it may be >>> what I want). >>> >>> Cordially, Wendell >>> >>> >>> >>> On Mon, Jan 19, 2015 at 1:55 AM, Christian Grün >>> christian.gruen@gmail.com wrote: >>>> Hi Wendell, hi Dirk, >>>> >>>> I'd like to jump in: Depending on the use case, I think I can >>>> absolutely make sense to work with the snapshot. The more feedback we >>>> get on potential errors, the more we'll be forced to keep it as stable >>>> as possible, and write more test cases ensuring it. Moreover, >>>> obviously, you'll always have access to the latest features. >>>> >>>> This is how your maven snippet needs to look like: >>>> >>>> <dependency> >>>> <groupId>org.basex</groupId> >>>> <artifactId>basex-api</artifactId> >>>> <version>8.0-SNAPSHOT</version> >>>> </dependency> >>>> >>>> Hope this helps, >>>> Christian >>>> >>>> >>>> On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote: >>>>> Hi Wendell, >>>>> >>>>> no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release: >>>>> >>>>> <dependency> >>>>> <groupId>org.basex</groupId> >>>>> <artifactId>basex-api</artifactId> >>>>> <version>7.9</version> >>>>> </dependency> >>>>> >>>>> >>>>> >>>>> >>>>> For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency: >>>>> >>>>> >>>>> <dependency> >>>>> <groupId>net.sf.saxon</groupId> >>>>> <artifactId>Saxon-HE</artifactId> >>>>> <version>SAXON-VERSION-YOU-LIKE</version> >>>>> </dependency> >>>>> >>>>> >>>>> Cheers, >>>>> Dirk >>>>> >>>>> >>>>> On 01/18/2015 10:29 PM, Wendell Piez wrote: >>>>>> BaseX friends, >>>>>> >>>>>> If I run BaseX from Maven, do I always get to use the latest BaseX? >>>>>> >>>>>> Do I have to do anything special to set up BaseX in Maven to use >>>>>> SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in >>>>>> my BaseX lib.) >>>>>> >>>>>> Thanks! Wendell >>>>>> >>>>>> >>>>> >>>>> -- >>>>> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de >>>>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >>>>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >>>>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >>>>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>>>> >>> >>> >>> >>> -- >>> Wendell Piez | http://www.wendellpiez.com >>> XML | XSLT | electronic publishing >>> Eat Your Vegetables >>> _____oo_________o_o___ooooo____ooooooo_^ > > > > -- > Wendell Piez | http://www.wendellpiez.com > XML | XSLT | electronic publishing > Eat Your Vegetables > _____oo_________o_o___ooooo____ooooooo_^
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
Dirk, Christian, and BaseX Maven users,
(If not interested in this whole Maven thing please read no further.)
So if I have this in my POM.xml
<profiles> <profile> <id>gui</id> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>org.basex.BaseXGUI</mainClass> </configuration> </plugin> </plugins> </build> </profile>
and from the cl I call
mvn exec:java -P gui
I can successfully start an instance of the BaseX GUI.
I have a couple of questions:
* Is using a profile in this way the best way (in Maven) to customize a call to a process? I.e. if elsewhere I wish to (provide a way for a user to) call a BaseX script, I could do mvn exec:java -P basex-script, with the appropriate profile containing the exec:java settings to invoke the script?
(If yes, seems sorta inside-out to me, but hey. :-)
* When I run the above, BaseX loads and the GUI starts (excellent). The GUI has no databases, however ... because BaseX expects to find them ... where?
I.e. what's the default setting for the data directory and how do I change it?
* I note in passing that the GUI by default opens a viewer to my /home directory. Is there any way to change that from the pom.xml?
* Are there other things I may wish to set in the pom.xml, such as memory allocation settings?
I might be back in a minute with more questions about running the BaseX http service under Maven. (Or it might take me a week.) In the meantime, thanks!
Cheers, Wendell
On Thu, Feb 5, 2015 at 5:49 AM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
I have attached a sample pom.xml file. This should allow you to cover your two main use cases (at least, that is what I see here): 1) Starting a Jetty server, so you can run RestXQ and 2) Running BaseX standalone so you can e.g. run a script
Using the exec maven plugin you can run any java program from Maven. So this part
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>org.basex.BaseX</mainClass> <arguments> <argument>-q 4+2</argument> </arguments> </configuration> </plugin>
simply output 6 if run via
mvn exec:java
You can also override the arguments via command line like so
mvn exec:java -Dexec.args="-q 7+1"
Starting jetty can be done as usual running mvn jetty:run
I would recommend you have such a pom.xml file in each of your project directories. This allows you e.g. to use different BaseX versions for your different projects (your latest project might want to use our 8.0 snapshot, your potential high-security banking project in production most likely should not run unstable software) . In the pom.files you can also incorporate different JVM parameters (as I suggested before using export BASEX_JVM=-p=/my/restxq/directory && basexhttp, but this time using maven).
If you use Maven in general, it does not mean you have to compile anything at all. On the contrary, it allows programmers to fetch already compiled versions and fit them into their program.
I should not that you could also use a more complex Maven approach and use a parent pom.xml file and subprojects (we do this in the core BaseX files, as basex-core and basex-api are actually different projects, bundled together in a parent project). This is all Maven specific - Maven is a build system, sou basically you can do almost anything. Question is, how much you want to dive into Maven configuration or if it is good enough for you for now to simple have something you can share and others can check out easily.
If you have a project with such an pom.xml file and you share it e.g. via github, it should be enough for your users to check out the repository and run e.g. mvn jetty:run. Of course, you can then also write maven goals for repeating task, e.g. optimizing the database. So you than would have to write a simple mvn exec:optimize, which would call BaseX with the require parameters to do your optimization.
Of course, you could also do all this completely without Maven. You could also write custom shell scripts and automatically download BaseX, etc. pp. Essentially, Maven is just a tool which saves you same work and simplifies dependency-management.
Regarding the maven archetypes, I don't think we use them at all. I don't have much knowledge about them (also about Maven, I just use it as a tool, but I am always amazed how complex it is), but I guess we would have to write same sample archetypes for them - Which we didn't, as far as I know.
And sorry about being pedantic on using the mailing list. But I truly think many people stumble onto the problems faced with project setup and Maven usage, so I think these people can benefit.
I hope this helps.
Cheers Dirk
On 02/04/2015 06:52 PM, Wendell Piez wrote:
Hi again Christian and Dirk:
I should also mention - another goal for me is that things be self-contained enough that I can share the whole thing on github, like here:
https://github.com/wendellpiez/Luminescent
Of course this is a huge mess since it has been architected by accretion, but the idea is that I (or anyone) would be able to download the stuff and start playing as quickly as possible. Mind you, this is meant as a long-term backup and project management strategy for me as much as anything -- since the point is less the processing than the results. However, I am working on the assumption that any improvement for anyone is an improvement for myself.
I don't need to deliver BaseX to my user, but I would like to give users (my future self) an easy way to run BaseX with the necessary settings and resources available, to get my XSLT/XQuery-driven functionality onto their systems and screens as speedily as possible.
Thanks again, Wendell
On Wed, Feb 4, 2015 at 12:36 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian,
Absolutely, the BaseX wiki page helps.
The one thing I am stuck on is the selection of the Maven archetype. I vaguely get that it will generate a POM (an editable and extensible configuration file) and a subdirectory structure, wherein I can develop my BaseX application.
But *which* Maven archetype of the many available is the appropriate one for my needs ... I cannot pretend to know.
I do not, however, wish to compile BaseX locally -- or at least, that is not a goal. (As a means to an end I can be convinced it'd be okay.) I won't be extending or manipulating BaseX itself or writing any Java; all my code is XQuery and XSLT.
(Indeed, minimizing a dependency on BaseX -- maintaining the capability to use the same libraries in another framework or environment -- such as Apache Cocoon, XProc pipelines, eXist, MarkLogic, what have you -- is a strategic goal for me. BaseX's support of standards along with its ease of use is thus very important to me.)
Currently, I have everything running well from a single BaseX installation, without Maven (tweaking the RESTXQ directory setting to point it to my project). However, I have more than one project using BaseX, and wish to keep them independent.
I am considering Maven as a good way for me to set up and configure BaseX, with minimal overhead, in a portable and project-specific way, not to customize or compile it, but just to run it ... call a script to update a database, then call another to start the http server ...
But my goal would also be accomplished if I knew how to do something comparatively simple (or so I would think): start up BaseX to run with a project-specific runtime setting.
So Dirk suggests a script that runs
export BASEX_JVM=-p=/my/restxq/directory && basexhttp
which I could totally do, as soon as I upgrade BaseX to v8.0.
Or, if Maven is a simple, clean, and lightweight way to do it, I'm not opposed. It's how that would or could work (in specific) for me, that has me stumped. I can type mvn generate:archetype and then fake it, and I can edit the POM and sniff around in the directory structure ... feeling increasingly like a blind monkey, if you get my drift.
But Dirk urged that I help support other newbies by asking these questions in public, albeit they are slightly OT (Maven, Linux scripting), since they have to do with setting up and running BaseX ...
So what's the appropriate maven archetype for me given I wish to run BaseX but not compile any Java, per se?
Thanks! Wendell
On Wed, Feb 4, 2015 at 2:58 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell,
For all us Maven innoscenti, I wonder if you could recommend which maven archetype one should use when getting started running BaseX? (Any guidance or resource appreciated.)
I would like to redirect you to our Wiki documentation [1]. Does it help, or do you think some essential information is missing here (which we could/should add)?
It's absolutely ok to run BaseX without Maven. The easiest thing is to use the zip file and start "basexhttp" (see e.g. [2] for more information).
Best, Christian
[1] http://docs.basex.org/wiki/Maven [2] http://docs.basex.org/wiki/Startup
On Tue, Feb 3, 2015 at 10:47 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian and Dirk,
I am guessing something with 'webapp' but I have no idea, I don't even know what "webapp" means in this context (although I think it may be what I want).
Cordially, Wendell
On Mon, Jan 19, 2015 at 1:55 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell, hi Dirk,
I'd like to jump in: Depending on the use case, I think I can absolutely make sense to work with the snapshot. The more feedback we get on potential errors, the more we'll be forced to keep it as stable as possible, and write more test cases ensuring it. Moreover, obviously, you'll always have access to the latest features.
This is how your maven snippet needs to look like:
<dependency> <groupId>org.basex</groupId> <artifactId>basex-api</artifactId> <version>8.0-SNAPSHOT</version> </dependency>
Hope this helps, Christian
On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote: > Hi Wendell, > > no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release: > > <dependency> > <groupId>org.basex</groupId> > <artifactId>basex-api</artifactId> > <version>7.9</version> > </dependency> > > > > > For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency: > > > <dependency> > <groupId>net.sf.saxon</groupId> > <artifactId>Saxon-HE</artifactId> > <version>SAXON-VERSION-YOU-LIKE</version> > </dependency> > > > Cheers, > Dirk > > > On 01/18/2015 10:29 PM, Wendell Piez wrote: >> BaseX friends, >> >> If I run BaseX from Maven, do I always get to use the latest BaseX? >> >> Do I have to do anything special to set up BaseX in Maven to use >> SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in >> my BaseX lib.) >> >> Thanks! Wendell >> >> > > -- > Dirk Kirsten, BaseX GmbH, http://basexgmbh.de > |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz > |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: > | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle > `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
Hi Wendell,
Including the following snippet into your configuration element should be enough to set the database path as you see it fit:
<systemProperties> <systemProperty> <key>org.basex.dbpath</key> <value>your/path/to/db</value> </systemProperty> </systemProperties>
More details can be found at http://mojo.codehaus.org/exec-maven-plugin/usage.html It also explains there how to set the memory allocation.
In general, how the home directory for BaseX is computed is explained in http://docs.basex.org/wiki/Configuration#Home_Directory
The project path can be set in your .basexgui directory setting PROJECTPATH = somevalue I am actually not sure whether it is possible to set this from the command line or maven, but I don't think so. Of course, using maven it would always be possible to create such a .basexgui file by yourself in an automated fashion.
We are currently at XML Prague, so answering could get a bit slow. For everyone who is also here you are of course welcome to speak to us, especially at our BaseX User Meetup today in the afternoon (http://www.xmlprague.cz/preconf2015/#basex). You won't get a better chance at personal debugging help than this, I guess.
Cheers Dirk
On 02/12/2015 11:42 PM, Wendell Piez wrote:
Dirk, Christian, and BaseX Maven users,
(If not interested in this whole Maven thing please read no further.)
So if I have this in my POM.xml
<profiles> <profile> <id>gui</id> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>org.basex.BaseXGUI</mainClass> </configuration> </plugin> </plugins> </build> </profile>
and from the cl I call
mvn exec:java -P gui
I can successfully start an instance of the BaseX GUI.
I have a couple of questions:
- Is using a profile in this way the best way (in Maven) to customize
a call to a process? I.e. if elsewhere I wish to (provide a way for a user to) call a BaseX script, I could do mvn exec:java -P basex-script, with the appropriate profile containing the exec:java settings to invoke the script?
(If yes, seems sorta inside-out to me, but hey. :-)
- When I run the above, BaseX loads and the GUI starts (excellent).
The GUI has no databases, however ... because BaseX expects to find them ... where?
I.e. what's the default setting for the data directory and how do I change it?
- I note in passing that the GUI by default opens a viewer to my /home
directory. Is there any way to change that from the pom.xml?
- Are there other things I may wish to set in the pom.xml, such as
memory allocation settings?
I might be back in a minute with more questions about running the BaseX http service under Maven. (Or it might take me a week.) In the meantime, thanks!
Cheers, Wendell
On Thu, Feb 5, 2015 at 5:49 AM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
I have attached a sample pom.xml file. This should allow you to cover your two main use cases (at least, that is what I see here): 1) Starting a Jetty server, so you can run RestXQ and 2) Running BaseX standalone so you can e.g. run a script
Using the exec maven plugin you can run any java program from Maven. So this part
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>org.basex.BaseX</mainClass> <arguments> <argument>-q 4+2</argument> </arguments> </configuration> </plugin>
simply output 6 if run via
mvn exec:java
You can also override the arguments via command line like so
mvn exec:java -Dexec.args="-q 7+1"
Starting jetty can be done as usual running mvn jetty:run
I would recommend you have such a pom.xml file in each of your project directories. This allows you e.g. to use different BaseX versions for your different projects (your latest project might want to use our 8.0 snapshot, your potential high-security banking project in production most likely should not run unstable software) . In the pom.files you can also incorporate different JVM parameters (as I suggested before using export BASEX_JVM=-p=/my/restxq/directory && basexhttp, but this time using maven).
If you use Maven in general, it does not mean you have to compile anything at all. On the contrary, it allows programmers to fetch already compiled versions and fit them into their program.
I should not that you could also use a more complex Maven approach and use a parent pom.xml file and subprojects (we do this in the core BaseX files, as basex-core and basex-api are actually different projects, bundled together in a parent project). This is all Maven specific - Maven is a build system, sou basically you can do almost anything. Question is, how much you want to dive into Maven configuration or if it is good enough for you for now to simple have something you can share and others can check out easily.
If you have a project with such an pom.xml file and you share it e.g. via github, it should be enough for your users to check out the repository and run e.g. mvn jetty:run. Of course, you can then also write maven goals for repeating task, e.g. optimizing the database. So you than would have to write a simple mvn exec:optimize, which would call BaseX with the require parameters to do your optimization.
Of course, you could also do all this completely without Maven. You could also write custom shell scripts and automatically download BaseX, etc. pp. Essentially, Maven is just a tool which saves you same work and simplifies dependency-management.
Regarding the maven archetypes, I don't think we use them at all. I don't have much knowledge about them (also about Maven, I just use it as a tool, but I am always amazed how complex it is), but I guess we would have to write same sample archetypes for them - Which we didn't, as far as I know.
And sorry about being pedantic on using the mailing list. But I truly think many people stumble onto the problems faced with project setup and Maven usage, so I think these people can benefit.
I hope this helps.
Cheers Dirk
On 02/04/2015 06:52 PM, Wendell Piez wrote:
Hi again Christian and Dirk:
I should also mention - another goal for me is that things be self-contained enough that I can share the whole thing on github, like here:
https://github.com/wendellpiez/Luminescent
Of course this is a huge mess since it has been architected by accretion, but the idea is that I (or anyone) would be able to download the stuff and start playing as quickly as possible. Mind you, this is meant as a long-term backup and project management strategy for me as much as anything -- since the point is less the processing than the results. However, I am working on the assumption that any improvement for anyone is an improvement for myself.
I don't need to deliver BaseX to my user, but I would like to give users (my future self) an easy way to run BaseX with the necessary settings and resources available, to get my XSLT/XQuery-driven functionality onto their systems and screens as speedily as possible.
Thanks again, Wendell
On Wed, Feb 4, 2015 at 12:36 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian,
Absolutely, the BaseX wiki page helps.
The one thing I am stuck on is the selection of the Maven archetype. I vaguely get that it will generate a POM (an editable and extensible configuration file) and a subdirectory structure, wherein I can develop my BaseX application.
But *which* Maven archetype of the many available is the appropriate one for my needs ... I cannot pretend to know.
I do not, however, wish to compile BaseX locally -- or at least, that is not a goal. (As a means to an end I can be convinced it'd be okay.) I won't be extending or manipulating BaseX itself or writing any Java; all my code is XQuery and XSLT.
(Indeed, minimizing a dependency on BaseX -- maintaining the capability to use the same libraries in another framework or environment -- such as Apache Cocoon, XProc pipelines, eXist, MarkLogic, what have you -- is a strategic goal for me. BaseX's support of standards along with its ease of use is thus very important to me.)
Currently, I have everything running well from a single BaseX installation, without Maven (tweaking the RESTXQ directory setting to point it to my project). However, I have more than one project using BaseX, and wish to keep them independent.
I am considering Maven as a good way for me to set up and configure BaseX, with minimal overhead, in a portable and project-specific way, not to customize or compile it, but just to run it ... call a script to update a database, then call another to start the http server ...
But my goal would also be accomplished if I knew how to do something comparatively simple (or so I would think): start up BaseX to run with a project-specific runtime setting.
So Dirk suggests a script that runs
export BASEX_JVM=-p=/my/restxq/directory && basexhttp
which I could totally do, as soon as I upgrade BaseX to v8.0.
Or, if Maven is a simple, clean, and lightweight way to do it, I'm not opposed. It's how that would or could work (in specific) for me, that has me stumped. I can type mvn generate:archetype and then fake it, and I can edit the POM and sniff around in the directory structure ... feeling increasingly like a blind monkey, if you get my drift.
But Dirk urged that I help support other newbies by asking these questions in public, albeit they are slightly OT (Maven, Linux scripting), since they have to do with setting up and running BaseX ...
So what's the appropriate maven archetype for me given I wish to run BaseX but not compile any Java, per se?
Thanks! Wendell
On Wed, Feb 4, 2015 at 2:58 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell,
For all us Maven innoscenti, I wonder if you could recommend which maven archetype one should use when getting started running BaseX? (Any guidance or resource appreciated.)
I would like to redirect you to our Wiki documentation [1]. Does it help, or do you think some essential information is missing here (which we could/should add)?
It's absolutely ok to run BaseX without Maven. The easiest thing is to use the zip file and start "basexhttp" (see e.g. [2] for more information).
Best, Christian
[1] http://docs.basex.org/wiki/Maven [2] http://docs.basex.org/wiki/Startup
On Tue, Feb 3, 2015 at 10:47 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian and Dirk,
I am guessing something with 'webapp' but I have no idea, I don't even know what "webapp" means in this context (although I think it may be what I want).
Cordially, Wendell
On Mon, Jan 19, 2015 at 1:55 AM, Christian Grün christian.gruen@gmail.com wrote: > Hi Wendell, hi Dirk, > > I'd like to jump in: Depending on the use case, I think I can > absolutely make sense to work with the snapshot. The more feedback we > get on potential errors, the more we'll be forced to keep it as stable > as possible, and write more test cases ensuring it. Moreover, > obviously, you'll always have access to the latest features. > > This is how your maven snippet needs to look like: > > <dependency> > <groupId>org.basex</groupId> > <artifactId>basex-api</artifactId> > <version>8.0-SNAPSHOT</version> > </dependency> > > Hope this helps, > Christian > > > On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote: >> Hi Wendell, >> >> no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release: >> >> <dependency> >> <groupId>org.basex</groupId> >> <artifactId>basex-api</artifactId> >> <version>7.9</version> >> </dependency> >> >> >> >> >> For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency: >> >> >> <dependency> >> <groupId>net.sf.saxon</groupId> >> <artifactId>Saxon-HE</artifactId> >> <version>SAXON-VERSION-YOU-LIKE</version> >> </dependency> >> >> >> Cheers, >> Dirk >> >> >> On 01/18/2015 10:29 PM, Wendell Piez wrote: >>> BaseX friends, >>> >>> If I run BaseX from Maven, do I always get to use the latest BaseX? >>> >>> Do I have to do anything special to set up BaseX in Maven to use >>> SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in >>> my BaseX lib.) >>> >>> Thanks! Wendell >>> >>> >> >> -- >> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de >> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
Hi,
I have dealt with various ways to include BaseX in a project using Gradle which uses Maven compatible dependency resolution. This thread does provide me some info that I can also apply to Gradle based builds. I was never a big fan of Maven and I found it to be too Java centric to handle projects that include XML system components such as BaseX. Anyways. What I did find though was a little issue with the dependency resolution that I don't see anyone reporting for Maven. Maybe Gradle handles dependency metadata a little bit differently.
The trouble is with a transitive dependency of basex-api. It uses com.ettrema:milton-api:1.8.1.4.
However, when I only specify http://files.basex.org/maven and http://xqj.net/maven (next to Maven Central) then it cannot resolve the above dependency. I fixed this issue by also adding https://raw.github.com/eXist-db/mvn-repo/master as a repository.
I looked at the metadata in http://files.basex.org/maven/com/ettrema/milton-api/maven-metadata.xml which has:
<metadata> <groupId>com.ettrema</groupId> <artifactId>milton-api</artifactId> <versioning> <latest>1.8.1.4</latest> <release>1.8.1.4</release> <versions> <version>1.7.2</version> <version>1.8.0.1</version> </versions> <lastUpdated>20120904214734</lastUpdated> </versioning> </metadata>
It seems that when I use Gradle it uses versions/version to determine if the dependency exists so it concludes that 1.8.1.4 isn't available. I don't know the exact semantics of maven metadata files but isn't this metadata inconsistent? 1.7.2 and 1.8.0.1 is in fact the only version available on files.basex.org/maven.
I will publish some Gradle related scripts once I have ironed out some more details. But here's a teaser which is a lot sexier than a Maven POM (as much as I like angled brackets, POM's are dead-ugly).
I transscribed one of Dirk's examples of running a query with Maven to Gradle.
repositories { maven { url "http://files.basex.org/maven" } maven { url "http://xqj.net/maven" } // I didn't think I needed this as the plugin adds it already (but that doesn't work) maven { url "https://raw.github.com/eXist-db/mvn-repo/master" } mavenCentral() }
configurations { basex }
dependencies { basex "org.basex:basex:8.0" basex "org.basex:basex-api:8.0" }
task query(type: JavaExec) { classpath configurations.basex main = "org.basex.BaseX" args "-q", "4+2" }
Nice.
btw have a nice conference, hope to be there next time.
Cheers, --Marc
On Fri, Feb 13, 2015 at 10:57 AM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
Including the following snippet into your configuration element should be enough to set the database path as you see it fit:
<systemProperties> <systemProperty> <key>org.basex.dbpath</key> <value>your/path/to/db</value> </systemProperty> </systemProperties>
More details can be found at http://mojo.codehaus.org/exec-maven-plugin/usage.html It also explains there how to set the memory allocation.
In general, how the home directory for BaseX is computed is explained in http://docs.basex.org/wiki/Configuration#Home_Directory
The project path can be set in your .basexgui directory setting PROJECTPATH = somevalue I am actually not sure whether it is possible to set this from the command line or maven, but I don't think so. Of course, using maven it would always be possible to create such a .basexgui file by yourself in an automated fashion.
We are currently at XML Prague, so answering could get a bit slow. For everyone who is also here you are of course welcome to speak to us, especially at our BaseX User Meetup today in the afternoon (http://www.xmlprague.cz/preconf2015/#basex). You won't get a better chance at personal debugging help than this, I guess.
Cheers Dirk
On 02/12/2015 11:42 PM, Wendell Piez wrote:
Dirk, Christian, and BaseX Maven users,
(If not interested in this whole Maven thing please read no further.)
So if I have this in my POM.xml
<profiles> <profile> <id>gui</id> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>org.basex.BaseXGUI</mainClass> </configuration> </plugin> </plugins> </build> </profile>
and from the cl I call
mvn exec:java -P gui
I can successfully start an instance of the BaseX GUI.
I have a couple of questions:
- Is using a profile in this way the best way (in Maven) to customize
a call to a process? I.e. if elsewhere I wish to (provide a way for a user to) call a BaseX script, I could do mvn exec:java -P basex-script, with the appropriate profile containing the exec:java settings to invoke the script?
(If yes, seems sorta inside-out to me, but hey. :-)
- When I run the above, BaseX loads and the GUI starts (excellent).
The GUI has no databases, however ... because BaseX expects to find them ... where?
I.e. what's the default setting for the data directory and how do I change it?
- I note in passing that the GUI by default opens a viewer to my /home
directory. Is there any way to change that from the pom.xml?
- Are there other things I may wish to set in the pom.xml, such as
memory allocation settings?
I might be back in a minute with more questions about running the BaseX http service under Maven. (Or it might take me a week.) In the meantime, thanks!
Cheers, Wendell
On Thu, Feb 5, 2015 at 5:49 AM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
I have attached a sample pom.xml file. This should allow you to cover your two main use cases (at least, that is what I see here): 1) Starting a Jetty server, so you can run RestXQ and 2) Running BaseX standalone so you can e.g. run a script
Using the exec maven plugin you can run any java program from Maven. So this part
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>org.basex.BaseX</mainClass> <arguments> <argument>-q 4+2</argument> </arguments> </configuration> </plugin>
simply output 6 if run via
mvn exec:java
You can also override the arguments via command line like so
mvn exec:java -Dexec.args="-q 7+1"
Starting jetty can be done as usual running mvn jetty:run
I would recommend you have such a pom.xml file in each of your project directories. This allows you e.g. to use different BaseX versions for your different projects (your latest project might want to use our 8.0 snapshot, your potential high-security banking project in production most likely should not run unstable software) . In the pom.files you can also incorporate different JVM parameters (as I suggested before using export BASEX_JVM=-p=/my/restxq/directory && basexhttp, but this time using maven).
If you use Maven in general, it does not mean you have to compile anything at all. On the contrary, it allows programmers to fetch already compiled versions and fit them into their program.
I should not that you could also use a more complex Maven approach and use a parent pom.xml file and subprojects (we do this in the core BaseX files, as basex-core and basex-api are actually different projects, bundled together in a parent project). This is all Maven specific - Maven is a build system, sou basically you can do almost anything. Question is, how much you want to dive into Maven configuration or if it is good enough for you for now to simple have something you can share and others can check out easily.
If you have a project with such an pom.xml file and you share it e.g. via github, it should be enough for your users to check out the repository and run e.g. mvn jetty:run. Of course, you can then also write maven goals for repeating task, e.g. optimizing the database. So you than would have to write a simple mvn exec:optimize, which would call BaseX with the require parameters to do your optimization.
Of course, you could also do all this completely without Maven. You could also write custom shell scripts and automatically download BaseX, etc. pp. Essentially, Maven is just a tool which saves you same work and simplifies dependency-management.
Regarding the maven archetypes, I don't think we use them at all. I don't have much knowledge about them (also about Maven, I just use it as a tool, but I am always amazed how complex it is), but I guess we would have to write same sample archetypes for them - Which we didn't, as far as I know.
And sorry about being pedantic on using the mailing list. But I truly think many people stumble onto the problems faced with project setup and Maven usage, so I think these people can benefit.
I hope this helps.
Cheers Dirk
On 02/04/2015 06:52 PM, Wendell Piez wrote:
Hi again Christian and Dirk:
I should also mention - another goal for me is that things be self-contained enough that I can share the whole thing on github, like here:
https://github.com/wendellpiez/Luminescent
Of course this is a huge mess since it has been architected by accretion, but the idea is that I (or anyone) would be able to download the stuff and start playing as quickly as possible. Mind you, this is meant as a long-term backup and project management strategy for me as much as anything -- since the point is less the processing than the results. However, I am working on the assumption that any improvement for anyone is an improvement for myself.
I don't need to deliver BaseX to my user, but I would like to give users (my future self) an easy way to run BaseX with the necessary settings and resources available, to get my XSLT/XQuery-driven functionality onto their systems and screens as speedily as possible.
Thanks again, Wendell
On Wed, Feb 4, 2015 at 12:36 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian,
Absolutely, the BaseX wiki page helps.
The one thing I am stuck on is the selection of the Maven archetype. I vaguely get that it will generate a POM (an editable and extensible configuration file) and a subdirectory structure, wherein I can develop my BaseX application.
But *which* Maven archetype of the many available is the appropriate one for my needs ... I cannot pretend to know.
I do not, however, wish to compile BaseX locally -- or at least, that is not a goal. (As a means to an end I can be convinced it'd be okay.) I won't be extending or manipulating BaseX itself or writing any Java; all my code is XQuery and XSLT.
(Indeed, minimizing a dependency on BaseX -- maintaining the capability to use the same libraries in another framework or environment -- such as Apache Cocoon, XProc pipelines, eXist, MarkLogic, what have you -- is a strategic goal for me. BaseX's support of standards along with its ease of use is thus very important to me.)
Currently, I have everything running well from a single BaseX installation, without Maven (tweaking the RESTXQ directory setting to point it to my project). However, I have more than one project using BaseX, and wish to keep them independent.
I am considering Maven as a good way for me to set up and configure BaseX, with minimal overhead, in a portable and project-specific way, not to customize or compile it, but just to run it ... call a script to update a database, then call another to start the http server ...
But my goal would also be accomplished if I knew how to do something comparatively simple (or so I would think): start up BaseX to run with a project-specific runtime setting.
So Dirk suggests a script that runs
export BASEX_JVM=-p=/my/restxq/directory && basexhttp
which I could totally do, as soon as I upgrade BaseX to v8.0.
Or, if Maven is a simple, clean, and lightweight way to do it, I'm not opposed. It's how that would or could work (in specific) for me, that has me stumped. I can type mvn generate:archetype and then fake it, and I can edit the POM and sniff around in the directory structure ... feeling increasingly like a blind monkey, if you get my drift.
But Dirk urged that I help support other newbies by asking these questions in public, albeit they are slightly OT (Maven, Linux scripting), since they have to do with setting up and running BaseX ...
So what's the appropriate maven archetype for me given I wish to run BaseX but not compile any Java, per se?
Thanks! Wendell
On Wed, Feb 4, 2015 at 2:58 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell,
> For all us Maven innoscenti, I wonder if you could recommend which > maven archetype one should use when getting started running BaseX? > (Any guidance or resource appreciated.)
I would like to redirect you to our Wiki documentation [1]. Does it help, or do you think some essential information is missing here (which we could/should add)?
It's absolutely ok to run BaseX without Maven. The easiest thing is to use the zip file and start "basexhttp" (see e.g. [2] for more information).
Best, Christian
[1] http://docs.basex.org/wiki/Maven [2] http://docs.basex.org/wiki/Startup
On Tue, Feb 3, 2015 at 10:47 PM, Wendell Piez wapiez@wendellpiez.com wrote: > Dear Christian and Dirk, > > > I am guessing something with 'webapp' but I have no idea, I don't even > know what "webapp" means in this context (although I think it may be > what I want). > > Cordially, Wendell > > > > On Mon, Jan 19, 2015 at 1:55 AM, Christian Grün > christian.gruen@gmail.com wrote: >> Hi Wendell, hi Dirk, >> >> I'd like to jump in: Depending on the use case, I think I can >> absolutely make sense to work with the snapshot. The more feedback we >> get on potential errors, the more we'll be forced to keep it as stable >> as possible, and write more test cases ensuring it. Moreover, >> obviously, you'll always have access to the latest features. >> >> This is how your maven snippet needs to look like: >> >> <dependency> >> <groupId>org.basex</groupId> >> <artifactId>basex-api</artifactId> >> <version>8.0-SNAPSHOT</version> >> </dependency> >> >> Hope this helps, >> Christian >> >> >> On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote: >>> Hi Wendell, >>> >>> no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release: >>> >>> <dependency> >>> <groupId>org.basex</groupId> >>> <artifactId>basex-api</artifactId> >>> <version>7.9</version> >>> </dependency> >>> >>> >>> >>> >>> For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency: >>> >>> >>> <dependency> >>> <groupId>net.sf.saxon</groupId> >>> <artifactId>Saxon-HE</artifactId> >>> <version>SAXON-VERSION-YOU-LIKE</version> >>> </dependency> >>> >>> >>> Cheers, >>> Dirk >>> >>> >>> On 01/18/2015 10:29 PM, Wendell Piez wrote: >>>> BaseX friends, >>>> >>>> If I run BaseX from Maven, do I always get to use the latest BaseX? >>>> >>>> Do I have to do anything special to set up BaseX in Maven to use >>>> SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in >>>> my BaseX lib.) >>>> >>>> Thanks! Wendell >>>> >>>> >>> >>> -- >>> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de >>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>> > > > > -- > Wendell Piez | http://www.wendellpiez.com > XML | XSLT | electronic publishing > Eat Your Vegetables > _____oo_________o_o___ooooo____ooooooo_^
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
I'm sending this again as my first try it didn't get picked up on the list.
--Marc
---------- Forwarded message ---------- From: Marc van Grootel marc.van.grootel@gmail.com Date: Fri, Feb 13, 2015 at 12:00 PM Subject: Re: [basex-talk] BaseX in maven To: BaseX basex-talk@mailman.uni-konstanz.de
Hi,
I have dealt with various ways to include BaseX in a project using Gradle which uses Maven compatible dependency resolution. This thread does provide me some info that I can also apply to Gradle based builds. I was never a big fan of Maven and I found it to be too Java centric to handle projects that include XML system components such as BaseX. Anyways. What I did find though was a little issue with the dependency resolution that I don't see anyone reporting for Maven. Maybe Gradle handles dependency metadata a little bit differently.
The trouble is with a transitive dependency of basex-api. It uses com.ettrema:milton-api:1.8.1.4.
However, when I only specify http://files.basex.org/maven and http://xqj.net/maven (next to Maven Central) then it cannot resolve the above dependency. I fixed this issue by also adding https://raw.github.com/eXist-db/mvn-repo/master as a repository.
I looked at the metadata in http://files.basex.org/maven/com/ettrema/milton-api/maven-metadata.xml which has:
<metadata> <groupId>com.ettrema</groupId> <artifactId>milton-api</artifactId> <versioning> <latest>1.8.1.4</latest> <release>1.8.1.4</release> <versions> <version>1.7.2</version> <version>1.8.0.1</version> </versions> <lastUpdated>20120904214734</lastUpdated> </versioning> </metadata>
It seems that when I use Gradle it uses versions/version to determine if the dependency exists so it concludes that 1.8.1.4 isn't available. I don't know the exact semantics of maven metadata files but isn't this metadata inconsistent? 1.7.2 and 1.8.0.1 is in fact the only version available on files.basex.org/maven.
I will publish some Gradle related scripts once I have ironed out some more details. But here's a teaser which is a lot sexier than a Maven POM (as much as I like angled brackets, POM's are dead-ugly).
I transscribed one of Dirk's examples of running a query with Maven to Gradle.
repositories { maven { url "http://files.basex.org/maven" } maven { url "http://xqj.net/maven" } maven { url "https://raw.github.com/eXist-db/mvn-repo/master" } mavenCentral() }
configurations { basex }
dependencies { basex "org.basex:basex:8.0" basex "org.basex:basex-api:8.0" }
task query(type: JavaExec) { classpath configurations.basex main = "org.basex.BaseX" args "-q", "4+2" }
Nice.
btw have a nice conference, hope to be there next time.
Cheers, --Marc
On Fri, Feb 13, 2015 at 10:57 AM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
Including the following snippet into your configuration element should be enough to set the database path as you see it fit:
<systemProperties> <systemProperty> <key>org.basex.dbpath</key> <value>your/path/to/db</value> </systemProperty> </systemProperties>
More details can be found at http://mojo.codehaus.org/exec-maven-plugin/usage.html It also explains there how to set the memory allocation.
In general, how the home directory for BaseX is computed is explained in http://docs.basex.org/wiki/Configuration#Home_Directory
The project path can be set in your .basexgui directory setting PROJECTPATH = somevalue I am actually not sure whether it is possible to set this from the command line or maven, but I don't think so. Of course, using maven it would always be possible to create such a .basexgui file by yourself in an automated fashion.
We are currently at XML Prague, so answering could get a bit slow. For everyone who is also here you are of course welcome to speak to us, especially at our BaseX User Meetup today in the afternoon (http://www.xmlprague.cz/preconf2015/#basex). You won't get a better chance at personal debugging help than this, I guess.
Cheers Dirk
-- --Marc
Hi Marc,
Thanks for the hint! We're currently on the way back from Prague; I'll most probably look at this tomorrow.
All the best, Christian Am 16.02.2015 10:11 schrieb "Marc van Grootel" <marc.van.grootel@gmail.com
:
I'm sending this again as my first try it didn't get picked up on the list.
--Marc
---------- Forwarded message ---------- From: Marc van Grootel marc.van.grootel@gmail.com Date: Fri, Feb 13, 2015 at 12:00 PM Subject: Re: [basex-talk] BaseX in maven To: BaseX basex-talk@mailman.uni-konstanz.de
Hi,
I have dealt with various ways to include BaseX in a project using Gradle which uses Maven compatible dependency resolution. This thread does provide me some info that I can also apply to Gradle based builds. I was never a big fan of Maven and I found it to be too Java centric to handle projects that include XML system components such as BaseX. Anyways. What I did find though was a little issue with the dependency resolution that I don't see anyone reporting for Maven. Maybe Gradle handles dependency metadata a little bit differently.
The trouble is with a transitive dependency of basex-api. It uses com.ettrema:milton-api:1.8.1.4.
However, when I only specify http://files.basex.org/maven and http://xqj.net/maven (next to Maven Central) then it cannot resolve the above dependency. I fixed this issue by also adding https://raw.github.com/eXist-db/mvn-repo/master as a repository.
I looked at the metadata in http://files.basex.org/maven/com/ettrema/milton-api/maven-metadata.xml which has:
<metadata> <groupId>com.ettrema</groupId> <artifactId>milton-api</artifactId> <versioning> <latest>1.8.1.4</latest> <release>1.8.1.4</release> <versions> <version>1.7.2</version> <version>1.8.0.1</version> </versions> <lastUpdated>20120904214734</lastUpdated> </versioning> </metadata>
It seems that when I use Gradle it uses versions/version to determine if the dependency exists so it concludes that 1.8.1.4 isn't available. I don't know the exact semantics of maven metadata files but isn't this metadata inconsistent? 1.7.2 and 1.8.0.1 is in fact the only version available on files.basex.org/maven.
I will publish some Gradle related scripts once I have ironed out some more details. But here's a teaser which is a lot sexier than a Maven POM (as much as I like angled brackets, POM's are dead-ugly).
I transscribed one of Dirk's examples of running a query with Maven to Gradle.
repositories { maven { url "http://files.basex.org/maven" } maven { url "http://xqj.net/maven" } maven { url "https://raw.github.com/eXist-db/mvn-repo/master" } mavenCentral() }
configurations { basex }
dependencies { basex "org.basex:basex:8.0" basex "org.basex:basex-api:8.0" }
task query(type: JavaExec) { classpath configurations.basex main = "org.basex.BaseX" args "-q", "4+2" }
Nice.
btw have a nice conference, hope to be there next time.
Cheers, --Marc
On Fri, Feb 13, 2015 at 10:57 AM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
Including the following snippet into your configuration element should
be enough to set the database path as you see it fit:
<systemProperties> <systemProperty> <key>org.basex.dbpath</key> <value>your/path/to/db</value> </systemProperty> </systemProperties>
More details can be found at
http://mojo.codehaus.org/exec-maven-plugin/usage.html It also explains there how to set the memory allocation.
In general, how the home directory for BaseX is computed is explained in
http://docs.basex.org/wiki/Configuration#Home_Directory
The project path can be set in your .basexgui directory setting
PROJECTPATH = somevalue
I am actually not sure whether it is possible to set this from the
command line or maven, but I don't think so. Of course, using maven it would always be possible to create such a .basexgui file by yourself in an automated fashion.
We are currently at XML Prague, so answering could get a bit slow. For
everyone who is also here you are of course welcome to speak to us, especially at our BaseX User Meetup today in the afternoon ( http://www.xmlprague.cz/preconf2015/#basex). You won't get a better chance at personal debugging help than this, I guess.
Cheers Dirk
-- --Marc
-- --Marc
Hi Marc,
I'm working up last week's mails; here's finally some feedback ;)
I looked at the metadata in http://files.basex.org/maven/com/ettrema/milton-api/maven-metadata.xml
I simply deleted those files, as I think they have been a relict from previous installations, and I updated the 1.8.1.4 files. Are the problems now solved?
Hope this helps, Christian
Hi Christian,
Yes indeed. This solves it. I removed the reference to the exist maven repo from the build script.
Thanks, --Marc
On Wed, Feb 18, 2015 at 9:30 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Marc,
I'm working up last week's mails; here's finally some feedback ;)
I looked at the metadata in http://files.basex.org/maven/com/ettrema/milton-api/maven-metadata.xml
I simply deleted those files, as I think they have been a relict from previous installations, and I updated the 1.8.1.4 files. Are the problems now solved?
Hope this helps, Christian
Dirk,
I make an annual tradition of wishing I was at XML Prague -- congratulations on v 8.0, thanks and I'll now take time for more experiments following your kind hints --
Cheers, Wendell
On Fri, Feb 13, 2015 at 4:57 AM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
Including the following snippet into your configuration element should be enough to set the database path as you see it fit:
<systemProperties> <systemProperty> <key>org.basex.dbpath</key> <value>your/path/to/db</value> </systemProperty> </systemProperties>
More details can be found at http://mojo.codehaus.org/exec-maven-plugin/usage.html It also explains there how to set the memory allocation.
In general, how the home directory for BaseX is computed is explained in http://docs.basex.org/wiki/Configuration#Home_Directory
The project path can be set in your .basexgui directory setting PROJECTPATH = somevalue I am actually not sure whether it is possible to set this from the command line or maven, but I don't think so. Of course, using maven it would always be possible to create such a .basexgui file by yourself in an automated fashion.
We are currently at XML Prague, so answering could get a bit slow. For everyone who is also here you are of course welcome to speak to us, especially at our BaseX User Meetup today in the afternoon (http://www.xmlprague.cz/preconf2015/#basex). You won't get a better chance at personal debugging help than this, I guess.
Cheers Dirk
On 02/12/2015 11:42 PM, Wendell Piez wrote:
Dirk, Christian, and BaseX Maven users,
(If not interested in this whole Maven thing please read no further.)
So if I have this in my POM.xml
<profiles> <profile> <id>gui</id> <build> <plugins> <plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>org.basex.BaseXGUI</mainClass> </configuration> </plugin> </plugins> </build> </profile>
and from the cl I call
mvn exec:java -P gui
I can successfully start an instance of the BaseX GUI.
I have a couple of questions:
- Is using a profile in this way the best way (in Maven) to customize
a call to a process? I.e. if elsewhere I wish to (provide a way for a user to) call a BaseX script, I could do mvn exec:java -P basex-script, with the appropriate profile containing the exec:java settings to invoke the script?
(If yes, seems sorta inside-out to me, but hey. :-)
- When I run the above, BaseX loads and the GUI starts (excellent).
The GUI has no databases, however ... because BaseX expects to find them ... where?
I.e. what's the default setting for the data directory and how do I change it?
- I note in passing that the GUI by default opens a viewer to my /home
directory. Is there any way to change that from the pom.xml?
- Are there other things I may wish to set in the pom.xml, such as
memory allocation settings?
I might be back in a minute with more questions about running the BaseX http service under Maven. (Or it might take me a week.) In the meantime, thanks!
Cheers, Wendell
On Thu, Feb 5, 2015 at 5:49 AM, Dirk Kirsten dk@basex.org wrote:
Hi Wendell,
I have attached a sample pom.xml file. This should allow you to cover your two main use cases (at least, that is what I see here): 1) Starting a Jetty server, so you can run RestXQ and 2) Running BaseX standalone so you can e.g. run a script
Using the exec maven plugin you can run any java program from Maven. So this part
<plugin> <groupId>org.codehaus.mojo</groupId> <artifactId>exec-maven-plugin</artifactId> <version>1.2.1</version> <configuration> <mainClass>org.basex.BaseX</mainClass> <arguments> <argument>-q 4+2</argument> </arguments> </configuration> </plugin>
simply output 6 if run via
mvn exec:java
You can also override the arguments via command line like so
mvn exec:java -Dexec.args="-q 7+1"
Starting jetty can be done as usual running mvn jetty:run
I would recommend you have such a pom.xml file in each of your project directories. This allows you e.g. to use different BaseX versions for your different projects (your latest project might want to use our 8.0 snapshot, your potential high-security banking project in production most likely should not run unstable software) . In the pom.files you can also incorporate different JVM parameters (as I suggested before using export BASEX_JVM=-p=/my/restxq/directory && basexhttp, but this time using maven).
If you use Maven in general, it does not mean you have to compile anything at all. On the contrary, it allows programmers to fetch already compiled versions and fit them into their program.
I should not that you could also use a more complex Maven approach and use a parent pom.xml file and subprojects (we do this in the core BaseX files, as basex-core and basex-api are actually different projects, bundled together in a parent project). This is all Maven specific - Maven is a build system, sou basically you can do almost anything. Question is, how much you want to dive into Maven configuration or if it is good enough for you for now to simple have something you can share and others can check out easily.
If you have a project with such an pom.xml file and you share it e.g. via github, it should be enough for your users to check out the repository and run e.g. mvn jetty:run. Of course, you can then also write maven goals for repeating task, e.g. optimizing the database. So you than would have to write a simple mvn exec:optimize, which would call BaseX with the require parameters to do your optimization.
Of course, you could also do all this completely without Maven. You could also write custom shell scripts and automatically download BaseX, etc. pp. Essentially, Maven is just a tool which saves you same work and simplifies dependency-management.
Regarding the maven archetypes, I don't think we use them at all. I don't have much knowledge about them (also about Maven, I just use it as a tool, but I am always amazed how complex it is), but I guess we would have to write same sample archetypes for them - Which we didn't, as far as I know.
And sorry about being pedantic on using the mailing list. But I truly think many people stumble onto the problems faced with project setup and Maven usage, so I think these people can benefit.
I hope this helps.
Cheers Dirk
On 02/04/2015 06:52 PM, Wendell Piez wrote:
Hi again Christian and Dirk:
I should also mention - another goal for me is that things be self-contained enough that I can share the whole thing on github, like here:
https://github.com/wendellpiez/Luminescent
Of course this is a huge mess since it has been architected by accretion, but the idea is that I (or anyone) would be able to download the stuff and start playing as quickly as possible. Mind you, this is meant as a long-term backup and project management strategy for me as much as anything -- since the point is less the processing than the results. However, I am working on the assumption that any improvement for anyone is an improvement for myself.
I don't need to deliver BaseX to my user, but I would like to give users (my future self) an easy way to run BaseX with the necessary settings and resources available, to get my XSLT/XQuery-driven functionality onto their systems and screens as speedily as possible.
Thanks again, Wendell
On Wed, Feb 4, 2015 at 12:36 PM, Wendell Piez wapiez@wendellpiez.com wrote:
Dear Christian,
Absolutely, the BaseX wiki page helps.
The one thing I am stuck on is the selection of the Maven archetype. I vaguely get that it will generate a POM (an editable and extensible configuration file) and a subdirectory structure, wherein I can develop my BaseX application.
But *which* Maven archetype of the many available is the appropriate one for my needs ... I cannot pretend to know.
I do not, however, wish to compile BaseX locally -- or at least, that is not a goal. (As a means to an end I can be convinced it'd be okay.) I won't be extending or manipulating BaseX itself or writing any Java; all my code is XQuery and XSLT.
(Indeed, minimizing a dependency on BaseX -- maintaining the capability to use the same libraries in another framework or environment -- such as Apache Cocoon, XProc pipelines, eXist, MarkLogic, what have you -- is a strategic goal for me. BaseX's support of standards along with its ease of use is thus very important to me.)
Currently, I have everything running well from a single BaseX installation, without Maven (tweaking the RESTXQ directory setting to point it to my project). However, I have more than one project using BaseX, and wish to keep them independent.
I am considering Maven as a good way for me to set up and configure BaseX, with minimal overhead, in a portable and project-specific way, not to customize or compile it, but just to run it ... call a script to update a database, then call another to start the http server ...
But my goal would also be accomplished if I knew how to do something comparatively simple (or so I would think): start up BaseX to run with a project-specific runtime setting.
So Dirk suggests a script that runs
export BASEX_JVM=-p=/my/restxq/directory && basexhttp
which I could totally do, as soon as I upgrade BaseX to v8.0.
Or, if Maven is a simple, clean, and lightweight way to do it, I'm not opposed. It's how that would or could work (in specific) for me, that has me stumped. I can type mvn generate:archetype and then fake it, and I can edit the POM and sniff around in the directory structure ... feeling increasingly like a blind monkey, if you get my drift.
But Dirk urged that I help support other newbies by asking these questions in public, albeit they are slightly OT (Maven, Linux scripting), since they have to do with setting up and running BaseX ...
So what's the appropriate maven archetype for me given I wish to run BaseX but not compile any Java, per se?
Thanks! Wendell
On Wed, Feb 4, 2015 at 2:58 AM, Christian Grün christian.gruen@gmail.com wrote:
Hi Wendell,
> For all us Maven innoscenti, I wonder if you could recommend which > maven archetype one should use when getting started running BaseX? > (Any guidance or resource appreciated.)
I would like to redirect you to our Wiki documentation [1]. Does it help, or do you think some essential information is missing here (which we could/should add)?
It's absolutely ok to run BaseX without Maven. The easiest thing is to use the zip file and start "basexhttp" (see e.g. [2] for more information).
Best, Christian
[1] http://docs.basex.org/wiki/Maven [2] http://docs.basex.org/wiki/Startup
On Tue, Feb 3, 2015 at 10:47 PM, Wendell Piez wapiez@wendellpiez.com wrote: > Dear Christian and Dirk, > > > I am guessing something with 'webapp' but I have no idea, I don't even > know what "webapp" means in this context (although I think it may be > what I want). > > Cordially, Wendell > > > > On Mon, Jan 19, 2015 at 1:55 AM, Christian Grün > christian.gruen@gmail.com wrote: >> Hi Wendell, hi Dirk, >> >> I'd like to jump in: Depending on the use case, I think I can >> absolutely make sense to work with the snapshot. The more feedback we >> get on potential errors, the more we'll be forced to keep it as stable >> as possible, and write more test cases ensuring it. Moreover, >> obviously, you'll always have access to the latest features. >> >> This is how your maven snippet needs to look like: >> >> <dependency> >> <groupId>org.basex</groupId> >> <artifactId>basex-api</artifactId> >> <version>8.0-SNAPSHOT</version> >> </dependency> >> >> Hope this helps, >> Christian >> >> >> On Sun, Jan 18, 2015 at 10:52 PM, Dirk Kirsten dk@basex.org wrote: >>> Hi Wendell, >>> >>> no, actually this is even bad practice. You should always explicitly set the required version in your pomfile. Otherwise, your application always uses the latest version and isn't realiably testable. The following should fetch BaseX 7.9, the latest stable release: >>> >>> <dependency> >>> <groupId>org.basex</groupId> >>> <artifactId>basex-api</artifactId> >>> <version>7.9</version> >>> </dependency> >>> >>> >>> >>> >>> For Saxon, if you have the jar file in your lib you should be good to go (are you sure however that you included it via maven). Should be somethin like that as dependency: >>> >>> >>> <dependency> >>> <groupId>net.sf.saxon</groupId> >>> <artifactId>Saxon-HE</artifactId> >>> <version>SAXON-VERSION-YOU-LIKE</version> >>> </dependency> >>> >>> >>> Cheers, >>> Dirk >>> >>> >>> On 01/18/2015 10:29 PM, Wendell Piez wrote: >>>> BaseX friends, >>>> >>>> If I run BaseX from Maven, do I always get to use the latest BaseX? >>>> >>>> Do I have to do anything special to set up BaseX in Maven to use >>>> SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in >>>> my BaseX lib.) >>>> >>>> Thanks! Wendell >>>> >>>> >>> >>> -- >>> Dirk Kirsten, BaseX GmbH, http://basexgmbh.de >>> |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz >>> |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: >>> | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle >>> `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22 >>> > > > > -- > Wendell Piez | http://www.wendellpiez.com > XML | XSLT | electronic publishing > Eat Your Vegetables > _____oo_________o_o___ooooo____ooooooo_^
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
-- Dirk Kirsten, BaseX GmbH, http://basexgmbh.de |-- Firmensitz: Blarerstrasse 56, 78462 Konstanz |-- Registergericht Freiburg, HRB: 708285, Geschäftsführer: | Dr. Christian Grün, Dr. Alexander Holupirek, Michael Seiferle `-- Phone: 0049 7531 28 28 676, Fax: 0049 7531 20 05 22
Hi,
I've created a simple starter build script for BaseX 8.0 with Gradle and Saxon 9.6. See https://github.com/xokomola/basex-gradle-starter Not a full-fledged build script yet but does illustrate how to set things up. Just follow the one-step installation instruction and you should be good to go ;-)
Feedback welcome.
Cheers, --Marc
On Sun, Jan 18, 2015 at 10:29 PM, Wendell Piez wapiez@wendellpiez.com wrote:
BaseX friends,
If I run BaseX from Maven, do I always get to use the latest BaseX?
Do I have to do anything special to set up BaseX in Maven to use SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in my BaseX lib.)
Thanks! Wendell
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
I transferred the basex-gradle-starter repo to our organization. Old links will keep working for a while but the official location will now be:
https://github.com/theapsgroup/basex-gradle-starter
--Marc
On Fri, Feb 13, 2015 at 10:27 PM, Marc van Grootel marc.van.grootel@gmail.com wrote:
Hi,
I've created a simple starter build script for BaseX 8.0 with Gradle and Saxon 9.6. See https://github.com/xokomola/basex-gradle-starter Not a full-fledged build script yet but does illustrate how to set things up. Just follow the one-step installation instruction and you should be good to go ;-)
Feedback welcome.
Cheers, --Marc
On Sun, Jan 18, 2015 at 10:29 PM, Wendell Piez wapiez@wendellpiez.com wrote:
BaseX friends,
If I run BaseX from Maven, do I always get to use the latest BaseX?
Do I have to do anything special to set up BaseX in Maven to use SaxonHE instead of Xalan for xslt:transform()? (I have Saxon9he.jar in my BaseX lib.)
Thanks! Wendell
-- Wendell Piez | http://www.wendellpiez.com XML | XSLT | electronic publishing Eat Your Vegetables _____oo_________o_o___ooooo____ooooooo_^
-- --Marc
basex-talk@mailman.uni-konstanz.de