<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>net.magneticpotato</groupId>
    <artifactId>sqlexpr-congocc</artifactId>
  
    <version>1.0.0</version>
    <name>SqlExprParser generated by CongoCC</name>
  
  	<packaging>jar</packaging>
  
  	<description>SQL Boolean Expression Parser generated by CongoCC</description>
  	<url>https://github.com/richcar58/sqlexpr-congocc</url>

    <properties>
        <!-- Java version -->
        <java-source.version>1.21</java-source.version>
        <java-target.version>1.21</java-target.version>

        <!-- Maven compiler plugin Java release support -->
        <maven-compiler-plugin-release>17</maven-compiler-plugin-release>

        <!--  Default to no release to suppress signing etc      -->
        <skip.signing>true</skip.signing>
        
        <!-- Source encoding -->
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        
        <!-- Capture the UTC build time for filtering use in children poms -->
        <!-- There's some goofy behavior that prevent the direct use of    -->
        <!-- maven property, so we format and reassign it.                 -->
        <build.timestamp>${maven.build.timestamp}</build.timestamp>
        <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'</maven.build.timestamp.format>
    </properties>
  
    <dependencies>
        <!-- https://mvnrepository.com/artifact/org.congocc/org.congocc.parser.generator -->
        <dependency>
            <groupId>org.congocc</groupId>
            <artifactId>org.congocc.parser.generator</artifactId>
            <version>2.0.0</version>
        </dependency>        
        <dependency>
            <groupId>org.apache.activemq</groupId>
            <artifactId>activemq-client</artifactId>
            <!-- <version>5.18.3</version> -->
            <version>6.1.6</version>
        </dependency>
        <dependency>
            <!-- There are only test dependencies on testng -->
            <groupId>org.testng</groupId>
            <artifactId>testng</artifactId>
            <version>7.10.2</version>
            <scope>test</scope>
        </dependency>
    </dependencies>

	<!-- Maintainers -->
    <developers>
        <developer>
            <name>Richard Cardone</name>
            <email>rcdev58@pm.me</email>
        </developer>
    </developers>
    
    <!-- Source code repository-->
    <scm>
        <connection>scm:git:git://github.com/richcar58/sqlexpr-javacc.git</connection>
        <developerConnection>scm:git:ssh://github.com:richcar58/sqlexpr-javacc.git</developerConnection>
        <url>http://github.com/richcar58/sqlexpr-javacc</url>
    </scm>    
  
	<!-- Maven Central Distribution -->
    <distributionManagement>
  		<snapshotRepository>
    		<id>ossrh</id>
    		<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
 		 </snapshotRepository>
  		<repository>
    		<id>ossrh</id>
    		<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
  		</repository>
	</distributionManagement>
	
	<!-- SqlExprParser license -->
	<licenses>
        <license>
            <name>MIT License</name>
            <url>http://www.opensource.org/licenses/mit-license.php</url>
        </license>
    </licenses>
	
	<!-- Use release profile for publishing to Maven Central -->
	<profiles>
  		<profile>
    		<id>release</id>
    		<build>
    			<plugins>
    			    <!-- See https://central.sonatype.org/publish/publish-maven/#javadoc-and-sources-attachments -->
    			    <!-- for magical configuration information for the source, javadoc and gpg plugins.          -->
    			    <!--                                                                                         -->
    			    <!-- Usage example that builds all jars and signs them:                                      --> 
    			    <!--                                                                                         --> 
    			    <!--      mvn clean install -P release                                                       -->
    			    <!--                                                                                         -->
    				<!-- Generate sources jar                                                                    -->
    				<plugin>
      					<groupId>org.apache.maven.plugins</groupId>
      					<artifactId>maven-source-plugin</artifactId>
      					<version>3.3.1</version>
      						<executions>
        						<execution>
          							<id>attach-sources</id>
          							<goals>
            							<goal>jar-no-fork</goal>
          							</goals>
        						</execution>
      						</executions>
    				</plugin>
    
    				<!-- Generate javadoc jar -->
    				<plugin>
      					<groupId>org.apache.maven.plugins</groupId>
      					<artifactId>maven-javadoc-plugin</artifactId>
      					<version>3.11.2</version>
      					<executions>
        					<execution>
          						<id>attach-javadocs</id>
          						<goals>
            						<goal>jar</goal>
          						</goals>
          						<configuration>
          						    <excludePackageNames>net.magneticpotato.sqlexpr.javacc</excludePackageNames>
          						</configuration>
        					</execution>
        					
      					</executions>
    				</plugin>  
    		
    				<!-- Sign artifacts using GPG -->
    				<plugin>
      					<groupId>org.apache.maven.plugins</groupId>
      					<artifactId>maven-gpg-plugin</artifactId>
      					<version>3.2.7</version>
      						<executions>
        						<execution>
          							<id>sign-artifacts</id>
          							<phase>verify</phase>
          							<goals>
            							<goal>sign</goal>
          							</goals>
          							<configuration>
          							    <!-- Super intuitive -->
            							<keyname>0x39FB5F6B</keyname>
            							<!-- Needed for gpg version 2.1 or more -->
            							<gpgArguments>
    										<arg>--pinentry-mode</arg>
    										<arg>loopback</arg>
  										</gpgArguments>
          							</configuration>
        						</execution>
     						</executions>
    				</plugin>
    			</plugins>
    		</build>
  		</profile>
	</profiles>

    <build>
        <sourceDirectory>src/main/java</sourceDirectory>

        <!-- buildnumber-maven-plugin updates properties in resources -->
        <resources>
            <!-- Write the project version number to the specified file. -->
            <!-- Setting the targetPath puts the file into the jar at the -->
            <!-- specified root-relative directory. The the modified -->
            <!-- tapis.version file is always copied to the target/classes -->
            <!-- directory. Do the same for other data that we want to -->
            <!-- capture. A jar and war file will contain these files -->
            <!-- as long as the templated files are in the configured -->
            <!-- directory in the child project. -->
            <resource>
                <directory>src/main/resources</directory>
                <targetPath>.</targetPath>
                <filtering>true</filtering>
                <includes>
                    <include>**/sqlexpr.version</include>
                    <include>**/sqlexpr.fullversion</include>
                    <include>**/git.info</include>
                    <include>**/build.time</include>
                </includes>
            </resource>

            <!-- For some reason, we have to tell maven, surefire or testng -->
            <!-- that all main/resources need to be copied to some target -->
            <!-- directory. We also have to tell them to NOT undo filtering -->
            <!-- for the files that we explicitly filter above. Good stuff. -->
            <resource>
                <directory>src/main/resources</directory>
                <filtering>false</filtering>
                <includes>
                    <include>**/*</include>
                </includes>
                <excludes>
                    <exclude>**/sqlexpr.version</exclude>
                    <exclude>**/sqlexpr.fullversion</exclude>
                    <exclude>**/git.info</exclude>
                    <exclude>**/build.time</exclude>
                </excludes>
            </resource>
        </resources>
        
        <plugins>
            <!-- Capture the git commit hash and branch identifiers.  -->
            <!-- We use the plugin only for git and depend on regular -->
            <!-- maven filtering for timestamp and code version. We   -->
            <!-- could use this plugin to update jar and war manifest -->
            <!-- files, but we use separate resource file filtering   -->
            <!-- instead. See the resources element below for         -->
            <!-- filtering details.                                   -->
            <!-- Puts the commit hash in resources                    -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>buildnumber-maven-plugin</artifactId>
                <version>3.2.0</version>
                <executions>
                    <execution>
                        <phase>validate</phase>
                        <goals>
                            <goal>create</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <doCheck>false</doCheck>
                    <doUpdate>false</doUpdate>
                    <shortRevisionLength>8</shortRevisionLength>
                </configuration>
            </plugin>
            
        <!-- Compile the builder program that calls the parser generator -->    
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.12.1</version>
                    <configuration>
                        <!-- The release tells maven what version of -->
                        <!-- the Java compiler to use internally. -->
                        <release>${maven-compiler-plugin-release}</release>
                        <source>${java-source.version}</source>
                        <target>${java-target.version}</target>
                    </configuration>
            <executions>
                <execution>
                    <id>compile-generator</id>
                    <phase>generate-sources</phase>
                    <goals>
                         <goal>compile</goal>
                    </goals>
                    <configuration>
                        <includes>
                            <include>net/magneticpotato/sqlexpr/congocc/generator/*.java</include>
                        </includes>
                        <excludes>
                            <exclude>net/magneticpotato/sqlexpr/congocc</exclude>
                        </excludes>
                    </configuration>
                </execution>
            </executions>
        </plugin>            
     
        <!-- Run the builder program to generate the parser source files -->
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>exec-maven-plugin</artifactId>
            <version>3.1.1</version>
            <executions>
                <execution>
                    <id>generate-codes</id>
                    <goals>
                        <goal>java</goal>
                    </goals>
                    <phase>generate-sources</phase>
                    <configuration>
                        <mainClass>net.magneticpotato.sqlexpr.congocc.generator.BuildSqlExprParser</mainClass>
                    </configuration>
                </execution>
            </executions>
        </plugin>

        <plugin>
                <!-- The version is set in the parent pom -->
                <!-- SKIPPING all tests.                  -->
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-surefire-plugin</artifactId>
                <version>3.5.2</version>
                <configuration>
                    <skipTests>true</skipTests>
                </configuration>
            </plugin>

			<!-- Maven Centrol Plugin -->
            <plugin>
                <groupId>org.sonatype.central</groupId>
                <artifactId>central-publishing-maven-plugin</artifactId>
                <version>0.7.0</version>
                <extensions>true</extensions>
                <configuration>
                    <publishingServerId>central</publishingServerId>
                    <autoPublish>false</autoPublish>
                    <waitUntil>validated</waitUntil>
                </configuration>
            </plugin>
    		
        </plugins>

        <finalName>sqlexprlib</finalName>
    </build>
</project>