Re: PL/Java new build plugin

From: Chapman Flack <chap(at)anastigmatix(dot)net>
To: Kartik Ohri <kartikohri13(at)gmail(dot)com>, pljava-dev(at)lists(dot)postgresql(dot)org
Subject: Re: PL/Java new build plugin
Date: 2020-06-27 20:56:05
Message-ID: 5EF7B265.3060907@anastigmatix.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pljava-dev

Hi!

On 06/26/20 16:33, Kartik Ohri wrote:
> Hi! I built a Hello, World! plugin and it seems that the build process will
> need to be a two step one. I am not completely sure about this though. I
> needed to run mvn clean install the first time I added the plugin module
> before I could execute the Mojo.

Oddly, that doesn't seem to be a problem when I try it here. Just for
grins, I added these lines in pljava-so/pom.xml:

<plugin>
<groupId>org.postgresql</groupId>
<artifactId>pljava.pgxs</artifactId>
<version>0.0.1-SNAPSHOT</version>
<executions>
<execution>
<goals>
<goal>count</goal>
</goals>
</execution>
</executions>
</plugin>

and ran an ordinary mvn clean install, and Maven (3.5.2) correctly
figured out it had better build pljava.pgxs before pljava-so, and it
all went smoothly in one run:

[INFO] Reactor Build Order:
[INFO]
[INFO] PostgreSQL PL/Java
[INFO] PL/Java API
[INFO] PL/Java backend Java code
[INFO] pljava.pgxs Maven Plugin
[INFO] PL/Java backend native code
[INFO] PL/Java Ant tasks
[INFO] PL/Java examples
[INFO] PL/Java packaging
...
[INFO] Building pljava.pgxs Maven Plugin 0.0.1-SNAPSHOT
...
[INFO] Building PL/Java backend native code 1.6.0-SNAPSHOT
...
[INFO] --- pljava.pgxs:0.0.1-SNAPSHOT:count (default) @ pljava-so ---
[INFO] Number of modules0
...
[INFO] Reactor Summary:
[INFO]
[INFO] PostgreSQL PL/Java ................................. SUCCESS
[INFO] PL/Java API ........................................ SUCCESS
[INFO] PL/Java backend Java code .......................... SUCCESS
[INFO] pljava.pgxs Maven Plugin ........................... SUCCESS
[INFO] PL/Java backend native code ........................ SUCCESS
[INFO] PL/Java Ant tasks .................................. SUCCESS
[INFO] PL/Java examples ................................... SUCCESS
[INFO] PL/Java packaging .................................. SUCCESS
[INFO]
[INFO] BUILD SUCCESS

I am glad I tried it, because I was feeling pretty sour about the idea
of a two-step build. :)

Were you using an earlier Maven version? I wonder if that might be
part of the story if it wouldn't build for you in one step. (I noticed
a maven.version 3.3.9 in your new pom).

It's ok to assume Maven 3.5.2 as the minimum; that already became
necessary in PR #268 [1].

I notice it gives the count of modules as zero, so I guess something
about the parameter injection didn't go right, but everything else
seemed to.

It's possible it gets *its own MavenProject* injected, which doesn't
have any modules, and it might be interesting to follow the project's
parent link (assuming there is one) and count those modules instead.

A few comments:

- the commit diff makes it look as if the entire top pom.xml has been
deleted and replaced [2].

I suspect that means you edited the file with some tool that both
changed the indenting, and made the lines double-spaced.

A commit like that is hard to review, and it interferes with git
tools for exploring the origins and history of changes. It's important
to check that a git diff is able to show just the specific changes
you intended to make in a given commit.

- PL/Java uses the same source code format conventions as PostgreSQL,
described in [3]. That will call for changing the indenting in the
added pom.xml and HelloWorldMojo.java file, and maybe a few other
details like placement of { and }.

- Java source files all (should) have the project's current comment
header at the top (with your name as contributor, of course).
Some of the older files have an older version that hasn't been
updated yet, but any of the recently touched ones should have the
right one (the one that refers to BSD 3-Clause).

- All the other subproject IDs are pljava-something, not pljava.something.

Congratulations, it seems to be a working plugin!

Regards,
-Chap

[1] https://github.com/tada/pljava/commit/bfbe4c2

[2]
https://github.com/amCap1712/pljava/commit/39596cf#diff-600376dffeb79835ede4a0b285078036

[3] https://www.postgresql.org/docs/12/source-format.html

In response to

Responses

Browse pljava-dev by date

  From Date Subject
Next Message Kartik Ohri 2020-06-29 20:46:48 Re: PL/Java new build plugin
Previous Message Kartik Ohri 2020-06-26 20:33:21 PL/Java new build plugin