FINERACT-2181: Some tweaks in the gradle build to ensure correct task processing
This commit is contained in:
committed by
Arnold Gálovics
parent
e840db50fc
commit
11cecb0d45
@@ -80,3 +80,59 @@ jmh {
|
||||
timeOnIteration = '2s' // Time per iteration
|
||||
benchmarkMode = ['thrpt'] // Default benchmark mode
|
||||
}
|
||||
|
||||
tasks.register('staticWeaveJpa', JavaExec) {
|
||||
dependsOn classes
|
||||
|
||||
def classesDir = layout.buildDirectory.dir("classes/java/main").get().asFile
|
||||
def outputDir = layout.buildDirectory.dir("weaved-classes").get().asFile
|
||||
def persistenceInfo = layout.buildDirectory.dir('static-weaving').get()
|
||||
copy {
|
||||
from file("src/main/resources/jpa/static-weaving/module/command/persistence.xml")
|
||||
into "${persistenceInfo}/META-INF/"
|
||||
}
|
||||
|
||||
mainClass.set("org.eclipse.persistence.tools.weaving.jpa.StaticWeave")
|
||||
classpath = sourceSets.main.runtimeClasspath
|
||||
|
||||
args = [
|
||||
'-persistenceinfo', persistenceInfo,
|
||||
classesDir.absolutePath,
|
||||
outputDir.absolutePath
|
||||
]
|
||||
}
|
||||
|
||||
tasks.register("weavedJar", Jar) {
|
||||
archiveClassifier.set("")
|
||||
dependsOn staticWeaveJpa
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
from(layout.buildDirectory.dir("weaved-classes"))
|
||||
exclude("META-INF/persistence.xml")
|
||||
}
|
||||
|
||||
// Configure the default jar task to depend on weavedJar and use its output
|
||||
tasks.named('jar') {
|
||||
dependsOn weavedJar
|
||||
enabled = false // Disable the default jar task
|
||||
// The weavedJar will be used as the primary artifact
|
||||
}
|
||||
|
||||
// Make sure the assemble task depends on weavedJar
|
||||
tasks.named('assemble') {
|
||||
dependsOn weavedJar
|
||||
}
|
||||
|
||||
tasks.named("test") {
|
||||
dependsOn staticWeaveJpa
|
||||
|
||||
def testClasses = layout.buildDirectory.dir("classes/java/test").get().asFile
|
||||
def weavedClasses = layout.buildDirectory.dir("weaved-classes").get().asFile
|
||||
def testResources = layout.buildDirectory.dir("resources/test").get().asFile
|
||||
|
||||
classpath = files(
|
||||
weavedClasses,
|
||||
testClasses,
|
||||
testResources,
|
||||
configurations.testRuntimeClasspath
|
||||
)
|
||||
}
|
||||
|
||||
@@ -41,6 +41,9 @@ dependencies {
|
||||
'com.ibm.icu:icu4j',
|
||||
'org.yakworks:spring-icu4j',
|
||||
)
|
||||
implementation('org.eclipse.persistence:org.eclipse.persistence.jpa') {
|
||||
exclude group: 'org.eclipse.persistence', module: 'jakarta.persistence'
|
||||
}
|
||||
|
||||
compileOnly 'org.projectlombok:lombok'
|
||||
annotationProcessor 'org.projectlombok:lombok'
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@
|
||||
*/
|
||||
package org.apache.fineract.command.persistence;
|
||||
|
||||
import org.apache.fineract.command.persistence.model.CommandEntity;
|
||||
import org.apache.fineract.command.persistence.domain.CommandEntity;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
|
||||
|
||||
+1
-1
@@ -16,7 +16,7 @@
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
package org.apache.fineract.command.persistence.model;
|
||||
package org.apache.fineract.command.persistence.domain;
|
||||
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import jakarta.persistence.Column;
|
||||
+1
-1
@@ -22,7 +22,7 @@ import static org.mapstruct.InjectionStrategy.CONSTRUCTOR;
|
||||
import static org.mapstruct.MappingConstants.ComponentModel.SPRING;
|
||||
|
||||
import org.apache.fineract.command.core.Command;
|
||||
import org.apache.fineract.command.persistence.model.CommandEntity;
|
||||
import org.apache.fineract.command.persistence.domain.CommandEntity;
|
||||
import org.mapstruct.InheritInverseConfiguration;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
distributed with this work for additional information
|
||||
regarding copyright ownership. The ASF licenses this file
|
||||
to you under the Apache License, Version 2.0 (the
|
||||
"License"); 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.
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<persistence version="2.0"
|
||||
xmlns="http://java.sun.com/xml/ns/persistence"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
|
||||
|
||||
<!-- This file is only used for static weaving, nothing more. -->
|
||||
<!-- You can find the runtime configuration in the JPAConfig class -->
|
||||
<persistence-unit name="jpa-pu" transaction-type="RESOURCE_LOCAL">
|
||||
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
|
||||
|
||||
<!-- Command Module Entities -->
|
||||
<class>org.apache.fineract.command.persistence.domain.CommandEntity</class>
|
||||
<class>org.apache.fineract.command.persistence.converter.JsonAttributeConverter</class>
|
||||
|
||||
<exclude-unlisted-classes>false</exclude-unlisted-classes>
|
||||
<properties>
|
||||
<property name="eclipselink.weaving" value="static" />
|
||||
</properties>
|
||||
</persistence-unit>
|
||||
</persistence>
|
||||
Reference in New Issue
Block a user