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 <d...@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 <wap...@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.gr...@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 <wap...@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.gr...@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 <d...@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



-- 
Wendell Piez | http://www.wendellpiez.com
XML | XSLT | electronic publishing
Eat Your Vegetables
_____oo_________o_o___ooooo____ooooooo_^

Reply via email to