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

	<parent>
		<groupId>org.cibseven</groupId>
		<artifactId>release-parent</artifactId>
		<version>1.3.0</version>
	</parent>

	<groupId>org.cibseven.webapp</groupId>
	<artifactId>cibseven-webclient</artifactId>
 	<version>2.1.0</version>
	<packaging>pom</packaging>

	<name>CIB seven webclient</name>
	<description>CIB seven WebClient is a modern web-based interface for managing and interacting with the CIB seven cloud platform, 
		providing seamless access to services and optimized workflows.</description>

	<properties>
		<target.path>${project.basedir}/target</target.path>
		<project.git.url>https://github.com/cibseven/cibseven-webclient.git</project.git.url>
		<nexus-repository.url>https://artifacts.cibseven.org</nexus-repository.url>

		<maven.compiler.source>17</maven.compiler.source>
		<maven.compiler.target>17</maven.compiler.target>
		<maven-war-plugin.version>3.4.0</maven-war-plugin.version>
		<maven-resources-plugin.version>3.3.1</maven-resources-plugin.version>
		<maven-compiler-plugin.version>3.13.0</maven-compiler-plugin.version>
		<maven-enforcer-plugin.version>3.4.1</maven-enforcer-plugin.version>

		<git-commit-id-maven-plugin.version>9.0.1</git-commit-id-maven-plugin.version>

		<jjwt.version>0.12.6</jjwt.version>
		<commons-io.version>2.18.0</commons-io.version>
		<common-auth.version>1.3.0</common-auth.version>
		<version.spring.boot>3.5.6</version.spring.boot>
		<version.openapi-starter-webmvc-ui>2.8.13</version.openapi-starter-webmvc-ui>
		<version.commons-lang3>3.18.0</version.commons-lang3>
		
		<image.tomcat-10-base>harbor.cib.de/dev/tomcat-10-base:2.0.0</image.tomcat-10-base>
		<jib-maven-plugin.version>3.4.6</jib-maven-plugin.version>
		<jib.from.image>${image.tomcat-10-base}</jib.from.image>
		<jib.to.image>harbor.cib.de/dev/cibseven-webclient:${project.version}</jib.to.image>

		<version.eirslett.frontend.maven.plugin>1.12.1</version.eirslett.frontend.maven.plugin>
		<version.nodejs>22.14.0</version.nodejs>
		<version.npm>10.9.2</version.npm>

		<!-- NPM publish tag configuration - empty by default (uses 'latest'), can be overridden with tag dev -->
		<npm.publish.tag.arg></npm.publish.tag.arg>

		<!-- REWRITE COPYRIGHT PARAMEMER FROM SUPER POM (CAMUNDA COPYRIGHT) -->
		<license.inlineHeader>Copyright CIB software GmbH and/or licensed to CIB software GmbH
under one or more contributor license agreements. See the NOTICE file
distributed with this work for additional information regarding copyright
ownership. CIB software licenses this file to you under the Apache License,
Version 2.0; you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

 Unless required by applicable law or agreed to in writing, software
 distributed under the License is distributed on an "AS IS" BASIS,
 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.</license.inlineHeader>

	</properties>

	<profiles>
		<profile>
			<id>normal-build</id>
			<activation>
				<property>
					<name>!release-npm-library</name>
				</property>
			</activation>
			<modules>
				<module>cibseven-webclient-web</module>
				<module>cibseven-webclient-core</module>
			</modules>
			<build>
				<plugins>
					<plugin>
						<artifactId>maven-clean-plugin</artifactId>
						<inherited>false</inherited>
						<configuration>
							<filesets>
								<fileset>
									<directory>./frontend/target</directory>
								</fileset>
							</filesets>
						</configuration>
					</plugin>
					<plugin>
						<groupId>com.github.eirslett</groupId>
						<artifactId>frontend-maven-plugin</artifactId>
						<version>${version.eirslett.frontend.maven.plugin}</version>
						<inherited>false</inherited>
						<configuration>
							<nodeVersion>v${version.nodejs}</nodeVersion>
							<npmVersion>${version.npm}</npmVersion>
							<workingDirectory>./frontend</workingDirectory>
							<outputdir>${project.build.directory}/webapp</outputdir>
							<skip>${skip.frontend.build}</skip>
						</configuration>
						<executions>
							<execution>
								<id>install node and npm</id>
								<goals>
									<goal>install-node-and-npm</goal>
								</goals>
							</execution>
							<execution>
								<id>npm ci</id>
								<goals>
									<goal>npm</goal>
								</goals>
								<phase>generate-resources</phase>
								<configuration>
									<arguments>ci --no-audit --no-fund</arguments>
								</configuration>
							</execution>
							<!--
							<execution>
								<id>License check</id>
								<goals>
									<goal>npm</goal>
								</goals>
								<phase>generate-resources</phase>
								<configuration>
									<arguments>run license-check</arguments>
								</configuration>
							</execution>
							-->
							<execution>
								<id>Test</id>
								<goals>
									<goal>npm</goal>
								</goals>
								<phase>generate-resources</phase>
								<configuration>
									<arguments>run test:report</arguments>
									<skip>${skipTests}</skip>
								</configuration>
							</execution>
							<execution>
								<id>Lint</id>
								<goals>
									<goal>npm</goal>
								</goals>
								<phase>generate-resources</phase>
								<configuration>
									<arguments>run lint</arguments>
									<skip>${skipTests}</skip>
								</configuration>
							</execution>
							<execution>
								<id>Build</id>
								<goals>
									<goal>npm</goal>
								</goals>
								<phase>generate-resources</phase>
								<configuration>
									<arguments>run build</arguments>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
		<profile>
			<id>release-npm-library</id>
			<activation>
				<property>
					<name>release-npm-library</name>
				</property>
			</activation>
			<build>
				<plugins>
					<plugin>
						<artifactId>maven-clean-plugin</artifactId>
						<inherited>false</inherited>
						<configuration>
							<filesets>
								<fileset>
									<directory>./frontend/target</directory>
								</fileset>
							</filesets>
						</configuration>
					</plugin>
					<plugin>
						<groupId>com.github.eirslett</groupId>
						<artifactId>frontend-maven-plugin</artifactId>
						<version>${version.eirslett.frontend.maven.plugin}</version>
						<inherited>false</inherited>
						<configuration>
							<nodeVersion>v${version.nodejs}</nodeVersion>
							<npmVersion>${version.npm}</npmVersion>
							<workingDirectory>${release-npm-library}</workingDirectory>
							<outputdir>${project.build.directory}/webapp</outputdir>
							<skip>${skip.frontend.build}</skip>
						</configuration>
						<executions>
							<execution>
								<id>install node and npm</id>
								<goals>
									<goal>install-node-and-npm</goal>
								</goals>
							</execution>
							<execution>
								<id>npm ci</id>
								<goals>
									<goal>npm</goal>
								</goals>
								<phase>generate-resources</phase>
								<configuration>
									<arguments>ci --no-audit --no-fund</arguments>
								</configuration>
							</execution>
							<execution>
								<id>npm version</id>
								<goals>
									<goal>npm</goal>
								</goals>
								<phase>generate-resources</phase>
								<configuration>
									<arguments>version --allow-same-version
										--no-git-tag-version ${project.version}</arguments>
									<skip>${skip.npm.version.update}</skip>
								</configuration>
							</execution>
							<execution>
								<id>Build</id>
								<goals>
									<goal>npm</goal>
								</goals>
								<phase>generate-resources</phase>
								<configuration>
									<arguments>run build:library</arguments>
								</configuration>
							</execution>
							<execution>
								<id>npm publish</id>
								<goals>
									<goal>npm</goal>
								</goals>
								<phase>generate-resources</phase>
								<configuration>
									<arguments>publish${npm.publish.tag.arg}</arguments>
								</configuration>
							</execution>
						</executions>
					</plugin>
				</plugins>
			</build>
		</profile>
			<profile>
				<id>add-missing-copyright</id>
				<build>
					<plugins>
						<plugin>
							<groupId>com.mycila</groupId>
							<artifactId>license-maven-plugin</artifactId>
							<version>5.0.0</version>
							<configuration>
								<mapping>
									<vue>XML_STYLE</vue>
								</mapping>
								<licenseSets>
									<licenseSet>
										<inlineHeader>${license.inlineHeader}</inlineHeader>
										<includes>
											<include>**/*.java</include>
											<include>**/*.js</include> 
											<include>**/*.vue</include>
										</includes>
									</licenseSet>
								</licenseSets>
							</configuration>
						</plugin>
					</plugins>
				</build>
			</profile>
	</profiles>

	<dependencyManagement>
		<dependencies>
			<dependency>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-dependencies</artifactId>
				<scope>import</scope>
				<type>pom</type>
				<version>${version.spring.boot}</version>
			</dependency>
		</dependencies>
	</dependencyManagement>

	<dependencies>
		<dependency>
			<groupId>org.projectlombok</groupId>
			<artifactId>lombok</artifactId>
			<scope>provided</scope>
		</dependency>
	</dependencies>

	<build>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-enforcer-plugin</artifactId>
				<version>${maven-enforcer-plugin.version}</version>
				<executions>
					<execution>
						<id>enforce-dependency-convergence</id>
						<goals>
							<goal>enforce</goal>
						</goals>
						<configuration>
							<rules>
								<DependencyConvergence />
							</rules>
							<fail>true</fail>
						</configuration>
					</execution>
				</executions>
			</plugin>
			<plugin>
				<artifactId>maven-clean-plugin</artifactId>
				<inherited>false</inherited>
				<configuration>
					<filesets>
						<fileset>
							<directory>./frontend/target</directory>
						</fileset>
					</filesets>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>${maven-compiler-plugin.version}</version>
				<configuration>
					<source>${maven.compiler.source}</source>
					<target>${maven.compiler.target}</target>
					<compilerArgs>
						<arg>-parameters</arg>
						<arg>-Werror</arg>
					</compilerArgs>
				</configuration>
			</plugin>	
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-javadoc-plugin</artifactId>
				<configuration>
					<failOnError>false</failOnError>
					<doclint>none</doclint>
				</configuration>
			</plugin>
		</plugins>
		<pluginManagement>
			<plugins>
				<plugin>
					<groupId>com.google.cloud.tools</groupId>
					<artifactId>jib-maven-plugin</artifactId>
					<version>${jib-maven-plugin.version}</version>
					<configuration>
						<skip>true</skip>
						<from>
							<image>${jib.from.image}</image>
						</from>
						<to>
							<image>${jib.to.image}</image>
						</to>
						<!-- https://github.com/GoogleContainerTools/jib/blob/master/jib-maven-plugin/README.md#extended-usage -->
						<container>
							<labels>
								<!-- https://github.com/opencontainers/image-spec/blob/main/annotations.md#pre-defined-annotation-keys -->
								<org.opencontainers.image.vendor>CIB software GmbH</org.opencontainers.image.vendor>
								<org.opencontainers.image.authors>CIB software GmbH</org.opencontainers.image.authors>
								<org.opencontainers.image.licenses>Proprietary software by CIB software GmbH</org.opencontainers.image.licenses>
								<org.opencontainers.image.title>${project.name}</org.opencontainers.image.title>
								<org.opencontainers.image.version>${project.version}</org.opencontainers.image.version>
								<org.opencontainers.image.ref.name>${jib.to.image}</org.opencontainers.image.ref.name>
								<org.opencontainers.image.description>${project.description}</org.opencontainers.image.description>
								<org.opencontainers.image.source>${project.git.url}</org.opencontainers.image.source>
								<org.opencontainers.image.url>${project.git.url}</org.opencontainers.image.url>
								<org.opencontainers.image.base.name>${jib.from.image}</org.opencontainers.image.base.name>
							</labels>
						</container>
					</configuration>
				</plugin>
			</plugins>
		</pluginManagement>
	</build>

	<repositories>
		<repository>
			<id>maven-central</id>
			<name>Maven Central</name>
			<url>https://repo1.maven.org/maven2</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
		<repository>
		<!-- Required for local builds by community users on master branch -->
			<id>mvn-cibseven-public</id>
			<name>CIB seven Public Repository</name>
			<url>https://artifacts.cibseven.org/repository/public</url>
			</repository>
		<repository>
		<!-- Required for local builds by developers on maintainance branches -->
			<id>mvn-cibseven-snapshots</id>
			<name>CIB seven Snapshots repository</name>
			<url>https://artifacts.cibseven.org/repository/snapshots</url>
		</repository>
	</repositories>

	<scm>
		<connection>scm:git:${project.git.url}</connection>
		<developerConnection>scm:git:${project.git.url}</developerConnection>
		<url>${project.git.url}</url>
		<tag>HEAD</tag>
	</scm>

</project>
