diff --git a/.bazelignore b/.bazelignore new file mode 100644 index 00000000..a108a019 --- /dev/null +++ b/.bazelignore @@ -0,0 +1,4 @@ +mapstruct-on-bazel/bazel-bin +mapstruct-on-bazel/bazel-out +mapstruct-on-bazel/bazel-testlogs +mapstruct-on-bazel/bazel-mapstruct-on-bazel diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5e323cfa..7898f976 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,36 +2,43 @@ name: CI on: [push, pull_request] +env: + MAVEN_ARGS: >- + -V -B --no-transfer-progress + -Dhttp.keepAlive=false -Dmaven.wagon.http.pool=false -Dmaven.wagon.httpconnectionManager.ttlSeconds=120 + jobs: linux_maven: strategy: fail-fast: false matrix: - java: [8, 11, 13, 14-ea, 15-ea] + java: [8, 11, 17, 21] name: 'Linux JDK ${{ matrix.java }} Maven' runs-on: ubuntu-latest steps: - name: 'Checkout' - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: 'Set up JDK' - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: + distribution: 'zulu' java-version: ${{ matrix.java }} - name: 'Test' - run: ./mvnw -V -B -U clean verify + run: ./mvnw ${MAVEN_ARGS} -U clean verify linux_gradle: strategy: fail-fast: false matrix: - java: [8, 11] + java: [8, 11, 17, 21] name: 'Linux JDK ${{ matrix.java }} Gradle' runs-on: ubuntu-latest steps: - name: 'Checkout' - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: 'Set up JDK' - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: + distribution: 'zulu' java-version: ${{ matrix.java }} - name: 'Test' run: ./gradlew buildAll @@ -39,21 +46,51 @@ jobs: name: 'Windows' runs-on: windows-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: 'Set up JDK 8' - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: + distribution: 'zulu' java-version: 8 - name: 'Test' - run: ./mvnw -V -B -U clean verify + run: ./mvnw ${MAVEN_ARGS} -U clean verify mac_maven: name: 'Mac OS' runs-on: macos-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: 'Set up JDK 8' - uses: actions/setup-java@v1 + uses: actions/setup-java@v4 with: + distribution: 'zulu' java-version: 8 - name: 'Test' - run: ./mvnw -V -B -U clean verify + run: ./mvnw ${MAVEN_ARGS} -U clean verify + linux_bazel: + strategy: + fail-fast: false + matrix: + java: [11, 17, 21] + name: 'Linux JDK ${{ matrix.java }} Bazel' + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up JDK + uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: ${{ matrix.java }} + - name: Setup Bazel + uses: bazel-contrib/setup-bazel@0.18.0 + with: + # Avoid downloading Bazel every time. + bazelisk-cache: true + # Store build cache per workflow. + disk-cache: ${{ github.workflow }} + # Share repository cache between workflows. + repository-cache: true + - name: Test + run: bazelisk test //... + - name: Build + run: bazelisk build //... diff --git a/.gitignore b/.gitignore index 2c887f83..6ef8429b 100644 --- a/.gitignore +++ b/.gitignore @@ -22,3 +22,6 @@ test-output # Gradle .gradle + +# Bazel +**/bazel-* \ No newline at end of file diff --git a/.mvn/wrapper/MavenWrapperDownloader.java b/.mvn/wrapper/MavenWrapperDownloader.java deleted file mode 100644 index b901097f..00000000 --- a/.mvn/wrapper/MavenWrapperDownloader.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * Copyright 2007-present the original author or authors. - * - * Licensed 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. - */ -import java.net.*; -import java.io.*; -import java.nio.channels.*; -import java.util.Properties; - -public class MavenWrapperDownloader { - - private static final String WRAPPER_VERSION = "0.5.6"; - /** - * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. - */ - private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" - + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; - - /** - * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to - * use instead of the default one. - */ - private static final String MAVEN_WRAPPER_PROPERTIES_PATH = - ".mvn/wrapper/maven-wrapper.properties"; - - /** - * Path where the maven-wrapper.jar will be saved to. - */ - private static final String MAVEN_WRAPPER_JAR_PATH = - ".mvn/wrapper/maven-wrapper.jar"; - - /** - * Name of the property which should be used to override the default download url for the wrapper. - */ - private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; - - public static void main(String args[]) { - System.out.println("- Downloader started"); - File baseDirectory = new File(args[0]); - System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); - - // If the maven-wrapper.properties exists, read it and check if it contains a custom - // wrapperUrl parameter. - File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); - String url = DEFAULT_DOWNLOAD_URL; - if(mavenWrapperPropertyFile.exists()) { - FileInputStream mavenWrapperPropertyFileInputStream = null; - try { - mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); - Properties mavenWrapperProperties = new Properties(); - mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); - url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); - } catch (IOException e) { - System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); - } finally { - try { - if(mavenWrapperPropertyFileInputStream != null) { - mavenWrapperPropertyFileInputStream.close(); - } - } catch (IOException e) { - // Ignore ... - } - } - } - System.out.println("- Downloading from: " + url); - - File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); - if(!outputFile.getParentFile().exists()) { - if(!outputFile.getParentFile().mkdirs()) { - System.out.println( - "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); - } - } - System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); - try { - downloadFileFromURL(url, outputFile); - System.out.println("Done"); - System.exit(0); - } catch (Throwable e) { - System.out.println("- Error downloading"); - e.printStackTrace(); - System.exit(1); - } - } - - private static void downloadFileFromURL(String urlString, File destination) throws Exception { - if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { - String username = System.getenv("MVNW_USERNAME"); - char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); - Authenticator.setDefault(new Authenticator() { - @Override - protected PasswordAuthentication getPasswordAuthentication() { - return new PasswordAuthentication(username, password); - } - }); - } - URL website = new URL(urlString); - ReadableByteChannel rbc; - rbc = Channels.newChannel(website.openStream()); - FileOutputStream fos = new FileOutputStream(destination); - fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); - fos.close(); - rbc.close(); - } - -} diff --git a/.mvn/wrapper/maven-wrapper.jar b/.mvn/wrapper/maven-wrapper.jar deleted file mode 100644 index 2cc7d4a5..00000000 Binary files a/.mvn/wrapper/maven-wrapper.jar and /dev/null differ diff --git a/.mvn/wrapper/maven-wrapper.properties b/.mvn/wrapper/maven-wrapper.properties index 642d572c..8dea6c22 100644 --- a/.mvn/wrapper/maven-wrapper.properties +++ b/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,3 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar +wrapperVersion=3.3.4 +distributionType=only-script +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.9.12/apache-maven-3.9.12-bin.zip diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 00000000..098eae1e --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,2 @@ +# Root BUILD file for mapstruct-examples +# The actual Bazel build is in the mapstruct-on-bazel subdirectory diff --git a/MODULE.bazel b/MODULE.bazel new file mode 100644 index 00000000..13954602 --- /dev/null +++ b/MODULE.bazel @@ -0,0 +1,19 @@ +module( + name = "mapstruct-examples", + version = "1.0.0", +) + +bazel_dep(name = "rules_java", version = "8.14.0") +bazel_dep(name = "rules_jvm_external", version = "6.6") + +maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") + +maven.install( + artifacts = [ + "org.mapstruct:mapstruct:1.7.0.Beta1", + "org.mapstruct:mapstruct-processor:1.7.0.Beta1", + "junit:junit:4.13.2", + "org.assertj:assertj-core:3.27.7", + ], +) +use_repo(maven, "maven") diff --git a/MODULE.bazel.lock b/MODULE.bazel.lock new file mode 100644 index 00000000..8fb08990 --- /dev/null +++ b/MODULE.bazel.lock @@ -0,0 +1,207 @@ +{ + "lockFileVersion": 24, + "registryFileHashes": { + "https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497", + "https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2", + "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/MODULE.bazel": "70390338f7a5106231d20620712f7cccb659cd0e9d073d1991c038eb9fc57589", + "https://bcr.bazel.build/modules/abseil-cpp/20230125.1/MODULE.bazel": "89047429cb0207707b2dface14ba7f8df85273d484c2572755be4bab7ce9c3a0", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.0.bcr.1/MODULE.bazel": "1c8cec495288dccd14fdae6e3f95f772c1c91857047a098fad772034264cc8cb", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.0/MODULE.bazel": "d253ae36a8bd9ee3c5955384096ccb6baf16a1b1e93e858370da0a3b94f77c16", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.1/MODULE.bazel": "fa92e2eb41a04df73cdabeec37107316f7e5272650f81d6cc096418fe647b915", + "https://bcr.bazel.build/modules/abseil-cpp/20240116.1/MODULE.bazel": "37bcdb4440fbb61df6a1c296ae01b327f19e9bb521f9b8e26ec854b6f97309ed", + "https://bcr.bazel.build/modules/abseil-cpp/20240116.1/source.json": "9be551b8d4e3ef76875c0d744b5d6a504a27e3ae67bc6b28f46415fd2d2957da", + "https://bcr.bazel.build/modules/bazel_features/1.1.1/MODULE.bazel": "27b8c79ef57efe08efccbd9dd6ef70d61b4798320b8d3c134fd571f78963dbcd", + "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8", + "https://bcr.bazel.build/modules/bazel_features/1.15.0/MODULE.bazel": "d38ff6e517149dc509406aca0db3ad1efdd890a85e049585b7234d04238e2a4d", + "https://bcr.bazel.build/modules/bazel_features/1.17.0/MODULE.bazel": "039de32d21b816b47bd42c778e0454217e9c9caac4a3cf8e15c7231ee3ddee4d", + "https://bcr.bazel.build/modules/bazel_features/1.18.0/MODULE.bazel": "1be0ae2557ab3a72a57aeb31b29be347bcdc5d2b1eb1e70f39e3851a7e97041a", + "https://bcr.bazel.build/modules/bazel_features/1.19.0/MODULE.bazel": "59adcdf28230d220f0067b1f435b8537dd033bfff8db21335ef9217919c7fb58", + "https://bcr.bazel.build/modules/bazel_features/1.30.0/MODULE.bazel": "a14b62d05969a293b80257e72e597c2da7f717e1e69fa8b339703ed6731bec87", + "https://bcr.bazel.build/modules/bazel_features/1.30.0/source.json": "b07e17f067fe4f69f90b03b36ef1e08fe0d1f3cac254c1241a1818773e3423bc", + "https://bcr.bazel.build/modules/bazel_features/1.4.1/MODULE.bazel": "e45b6bb2350aff3e442ae1111c555e27eac1d915e77775f6fdc4b351b758b5d7", + "https://bcr.bazel.build/modules/bazel_features/1.9.1/MODULE.bazel": "8f679097876a9b609ad1f60249c49d68bfab783dd9be012faf9d82547b14815a", + "https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8", + "https://bcr.bazel.build/modules/bazel_skylib/1.1.1/MODULE.bazel": "1add3e7d93ff2e6998f9e118022c84d163917d912f5afafb3058e3d2f1545b5e", + "https://bcr.bazel.build/modules/bazel_skylib/1.2.0/MODULE.bazel": "44fe84260e454ed94ad326352a698422dbe372b21a1ac9f3eab76eb531223686", + "https://bcr.bazel.build/modules/bazel_skylib/1.2.1/MODULE.bazel": "f35baf9da0efe45fa3da1696ae906eea3d615ad41e2e3def4aeb4e8bc0ef9a7a", + "https://bcr.bazel.build/modules/bazel_skylib/1.3.0/MODULE.bazel": "20228b92868bf5cfc41bda7afc8a8ba2a543201851de39d990ec957b513579c5", + "https://bcr.bazel.build/modules/bazel_skylib/1.4.1/MODULE.bazel": "a0dcb779424be33100dcae821e9e27e4f2901d9dfd5333efe5ac6a8d7ab75e1d", + "https://bcr.bazel.build/modules/bazel_skylib/1.4.2/MODULE.bazel": "3bd40978e7a1fac911d5989e6b09d8f64921865a45822d8b09e815eaa726a651", + "https://bcr.bazel.build/modules/bazel_skylib/1.5.0/MODULE.bazel": "32880f5e2945ce6a03d1fbd588e9198c0a959bb42297b2cfaf1685b7bc32e138", + "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/MODULE.bazel": "8fdee2dbaace6c252131c00e1de4b165dc65af02ea278476187765e1a617b917", + "https://bcr.bazel.build/modules/bazel_skylib/1.7.0/MODULE.bazel": "0db596f4563de7938de764cc8deeabec291f55e8ec15299718b93c4423e9796d", + "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/MODULE.bazel": "3120d80c5861aa616222ec015332e5f8d3171e062e3e804a2a0253e1be26e59b", + "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/source.json": "f121b43eeefc7c29efbd51b83d08631e2347297c95aac9764a701f2a6a2bb953", + "https://bcr.bazel.build/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84", + "https://bcr.bazel.build/modules/buildozer/7.1.2/source.json": "c9028a501d2db85793a6996205c8de120944f50a0d570438fcae0457a5f9d1f8", + "https://bcr.bazel.build/modules/google_benchmark/1.8.2/MODULE.bazel": "a70cf1bba851000ba93b58ae2f6d76490a9feb74192e57ab8e8ff13c34ec50cb", + "https://bcr.bazel.build/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4", + "https://bcr.bazel.build/modules/googletest/1.14.0.bcr.1/MODULE.bazel": "22c31a561553727960057361aa33bf20fb2e98584bc4fec007906e27053f80c6", + "https://bcr.bazel.build/modules/googletest/1.14.0.bcr.1/source.json": "41e9e129f80d8c8bf103a7acc337b76e54fad1214ac0a7084bf24f4cd924b8b4", + "https://bcr.bazel.build/modules/googletest/1.14.0/MODULE.bazel": "cfbcbf3e6eac06ef9d85900f64424708cc08687d1b527f0ef65aa7517af8118f", + "https://bcr.bazel.build/modules/jsoncpp/1.9.5/MODULE.bazel": "31271aedc59e815656f5736f282bb7509a97c7ecb43e927ac1a37966e0578075", + "https://bcr.bazel.build/modules/jsoncpp/1.9.5/source.json": "4108ee5085dd2885a341c7fab149429db457b3169b86eb081fa245eadf69169d", + "https://bcr.bazel.build/modules/libpfm/4.11.0/MODULE.bazel": "45061ff025b301940f1e30d2c16bea596c25b176c8b6b3087e92615adbd52902", + "https://bcr.bazel.build/modules/platforms/0.0.10/MODULE.bazel": "8cb8efaf200bdeb2150d93e162c40f388529a25852b332cec879373771e48ed5", + "https://bcr.bazel.build/modules/platforms/0.0.11/MODULE.bazel": "0daefc49732e227caa8bfa834d65dc52e8cc18a2faf80df25e8caea151a9413f", + "https://bcr.bazel.build/modules/platforms/0.0.11/source.json": "f7e188b79ebedebfe75e9e1d098b8845226c7992b307e28e1496f23112e8fc29", + "https://bcr.bazel.build/modules/platforms/0.0.4/MODULE.bazel": "9b328e31ee156f53f3c416a64f8491f7eb731742655a47c9eec4703a71644aee", + "https://bcr.bazel.build/modules/platforms/0.0.5/MODULE.bazel": "5733b54ea419d5eaf7997054bb55f6a1d0b5ff8aedf0176fef9eea44f3acda37", + "https://bcr.bazel.build/modules/platforms/0.0.6/MODULE.bazel": "ad6eeef431dc52aefd2d77ed20a4b353f8ebf0f4ecdd26a807d2da5aa8cd0615", + "https://bcr.bazel.build/modules/platforms/0.0.7/MODULE.bazel": "72fd4a0ede9ee5c021f6a8dd92b503e089f46c227ba2813ff183b71616034814", + "https://bcr.bazel.build/modules/platforms/0.0.8/MODULE.bazel": "9f142c03e348f6d263719f5074b21ef3adf0b139ee4c5133e2aa35664da9eb2d", + "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel": "a5a29bb89544f9b97edce05642fac225a808b5b7be74038ea3640fae2f8e66a7", + "https://bcr.bazel.build/modules/protobuf/27.0/MODULE.bazel": "7873b60be88844a0a1d8f80b9d5d20cfbd8495a689b8763e76c6372998d3f64c", + "https://bcr.bazel.build/modules/protobuf/27.1/MODULE.bazel": "703a7b614728bb06647f965264967a8ef1c39e09e8f167b3ca0bb1fd80449c0d", + "https://bcr.bazel.build/modules/protobuf/29.0-rc2/MODULE.bazel": "6241d35983510143049943fc0d57937937122baf1b287862f9dc8590fc4c37df", + "https://bcr.bazel.build/modules/protobuf/29.0/MODULE.bazel": "319dc8bf4c679ff87e71b1ccfb5a6e90a6dbc4693501d471f48662ac46d04e4e", + "https://bcr.bazel.build/modules/protobuf/29.0/source.json": "b857f93c796750eef95f0d61ee378f3420d00ee1dd38627b27193aa482f4f981", + "https://bcr.bazel.build/modules/protobuf/3.19.0/MODULE.bazel": "6b5fbb433f760a99a22b18b6850ed5784ef0e9928a72668b66e4d7ccd47db9b0", + "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/MODULE.bazel": "88af1c246226d87e65be78ed49ecd1e6f5e98648558c14ce99176da041dc378e", + "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/source.json": "be4789e951dd5301282729fe3d4938995dc4c1a81c2ff150afc9f1b0504c6022", + "https://bcr.bazel.build/modules/re2/2023-09-01/MODULE.bazel": "cb3d511531b16cfc78a225a9e2136007a48cf8a677e4264baeab57fe78a80206", + "https://bcr.bazel.build/modules/re2/2023-09-01/source.json": "e044ce89c2883cd957a2969a43e79f7752f9656f6b20050b62f90ede21ec6eb4", + "https://bcr.bazel.build/modules/rules_android/0.1.1/MODULE.bazel": "48809ab0091b07ad0182defb787c4c5328bd3a278938415c00a7b69b50c4d3a8", + "https://bcr.bazel.build/modules/rules_android/0.1.1/source.json": "e6986b41626ee10bdc864937ffb6d6bf275bb5b9c65120e6137d56e6331f089e", + "https://bcr.bazel.build/modules/rules_cc/0.0.1/MODULE.bazel": "cb2aa0747f84c6c3a78dad4e2049c154f08ab9d166b1273835a8174940365647", + "https://bcr.bazel.build/modules/rules_cc/0.0.10/MODULE.bazel": "ec1705118f7eaedd6e118508d3d26deba2a4e76476ada7e0e3965211be012002", + "https://bcr.bazel.build/modules/rules_cc/0.0.13/MODULE.bazel": "0e8529ed7b323dad0775ff924d2ae5af7640b23553dfcd4d34344c7e7a867191", + "https://bcr.bazel.build/modules/rules_cc/0.0.14/MODULE.bazel": "5e343a3aac88b8d7af3b1b6d2093b55c347b8eefc2e7d1442f7a02dc8fea48ac", + "https://bcr.bazel.build/modules/rules_cc/0.0.15/MODULE.bazel": "6704c35f7b4a72502ee81f61bf88706b54f06b3cbe5558ac17e2e14666cd5dcc", + "https://bcr.bazel.build/modules/rules_cc/0.0.16/MODULE.bazel": "7661303b8fc1b4d7f532e54e9d6565771fea666fbdf839e0a86affcd02defe87", + "https://bcr.bazel.build/modules/rules_cc/0.0.2/MODULE.bazel": "6915987c90970493ab97393024c156ea8fb9f3bea953b2f3ec05c34f19b5695c", + "https://bcr.bazel.build/modules/rules_cc/0.0.6/MODULE.bazel": "abf360251023dfe3efcef65ab9d56beefa8394d4176dd29529750e1c57eaa33f", + "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e", + "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel": "836e76439f354b89afe6a911a7adf59a6b2518fafb174483ad78a2a2fde7b1c5", + "https://bcr.bazel.build/modules/rules_cc/0.1.1/MODULE.bazel": "2f0222a6f229f0bf44cd711dc13c858dad98c62d52bd51d8fc3a764a83125513", + "https://bcr.bazel.build/modules/rules_cc/0.1.1/source.json": "d61627377bd7dd1da4652063e368d9366fc9a73920bfa396798ad92172cf645c", + "https://bcr.bazel.build/modules/rules_foreign_cc/0.9.0/MODULE.bazel": "c9e8c682bf75b0e7c704166d79b599f93b72cfca5ad7477df596947891feeef6", + "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/MODULE.bazel": "40c97d1144356f52905566c55811f13b299453a14ac7769dfba2ac38192337a8", + "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/source.json": "c8b1e2c717646f1702290959a3302a178fb639d987ab61d548105019f11e527e", + "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74", + "https://bcr.bazel.build/modules/rules_java/5.3.5/MODULE.bazel": "a4ec4f2db570171e3e5eb753276ee4b389bae16b96207e9d3230895c99644b86", + "https://bcr.bazel.build/modules/rules_java/6.0.0/MODULE.bazel": "8a43b7df601a7ec1af61d79345c17b31ea1fedc6711fd4abfd013ea612978e39", + "https://bcr.bazel.build/modules/rules_java/6.4.0/MODULE.bazel": "e986a9fe25aeaa84ac17ca093ef13a4637f6107375f64667a15999f77db6c8f6", + "https://bcr.bazel.build/modules/rules_java/6.5.2/MODULE.bazel": "1d440d262d0e08453fa0c4d8f699ba81609ed0e9a9a0f02cd10b3e7942e61e31", + "https://bcr.bazel.build/modules/rules_java/7.10.0/MODULE.bazel": "530c3beb3067e870561739f1144329a21c851ff771cd752a49e06e3dc9c2e71a", + "https://bcr.bazel.build/modules/rules_java/7.12.2/MODULE.bazel": "579c505165ee757a4280ef83cda0150eea193eed3bef50b1004ba88b99da6de6", + "https://bcr.bazel.build/modules/rules_java/7.2.0/MODULE.bazel": "06c0334c9be61e6cef2c8c84a7800cef502063269a5af25ceb100b192453d4ab", + "https://bcr.bazel.build/modules/rules_java/7.3.2/MODULE.bazel": "50dece891cfdf1741ea230d001aa9c14398062f2b7c066470accace78e412bc2", + "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe", + "https://bcr.bazel.build/modules/rules_java/8.14.0/MODULE.bazel": "717717ed40cc69994596a45aec6ea78135ea434b8402fb91b009b9151dd65615", + "https://bcr.bazel.build/modules/rules_java/8.14.0/source.json": "8a88c4ca9e8759da53cddc88123880565c520503321e2566b4e33d0287a3d4bc", + "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7", + "https://bcr.bazel.build/modules/rules_jvm_external/5.1/MODULE.bazel": "33f6f999e03183f7d088c9be518a63467dfd0be94a11d0055fe2d210f89aa909", + "https://bcr.bazel.build/modules/rules_jvm_external/5.2/MODULE.bazel": "d9351ba35217ad0de03816ef3ed63f89d411349353077348a45348b096615036", + "https://bcr.bazel.build/modules/rules_jvm_external/5.3/MODULE.bazel": "bf93870767689637164657731849fb887ad086739bd5d360d90007a581d5527d", + "https://bcr.bazel.build/modules/rules_jvm_external/6.1/MODULE.bazel": "75b5fec090dbd46cf9b7d8ea08cf84a0472d92ba3585b476f44c326eda8059c4", + "https://bcr.bazel.build/modules/rules_jvm_external/6.3/MODULE.bazel": "c998e060b85f71e00de5ec552019347c8bca255062c990ac02d051bb80a38df0", + "https://bcr.bazel.build/modules/rules_jvm_external/6.6/MODULE.bazel": "153042249c7060536dc95b6bb9f9bb8063b8a0b0cb7acdb381bddbc2374aed55", + "https://bcr.bazel.build/modules/rules_jvm_external/6.6/source.json": "b1d7ffc3877e5a76e6e48e6bce459cbb1712c90eba14861b112bd299587a534d", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.0/MODULE.bazel": "ef85697305025e5a61f395d4eaede272a5393cee479ace6686dba707de804d59", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/MODULE.bazel": "d269a01a18ee74d0335450b10f62c9ed81f2321d7958a2934e44272fe82dcef3", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/source.json": "2faa4794364282db7c06600b7e5e34867a564ae91bda7cae7c29c64e9466b7d5", + "https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0", + "https://bcr.bazel.build/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d", + "https://bcr.bazel.build/modules/rules_license/1.0.0/MODULE.bazel": "a7fda60eefdf3d8c827262ba499957e4df06f659330bbe6cdbdb975b768bb65c", + "https://bcr.bazel.build/modules/rules_license/1.0.0/source.json": "a52c89e54cc311196e478f8382df91c15f7a2bfdf4c6cd0e2675cc2ff0b56efb", + "https://bcr.bazel.build/modules/rules_pkg/0.7.0/MODULE.bazel": "df99f03fc7934a4737122518bb87e667e62d780b610910f0447665a7e2be62dc", + "https://bcr.bazel.build/modules/rules_pkg/1.0.1/MODULE.bazel": "5b1df97dbc29623bccdf2b0dcd0f5cb08e2f2c9050aab1092fd39a41e82686ff", + "https://bcr.bazel.build/modules/rules_pkg/1.0.1/source.json": "bd82e5d7b9ce2d31e380dd9f50c111d678c3bdaca190cb76b0e1c71b05e1ba8a", + "https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06", + "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7", + "https://bcr.bazel.build/modules/rules_proto/6.0.2/MODULE.bazel": "ce916b775a62b90b61888052a416ccdda405212b6aaeb39522f7dc53431a5e73", + "https://bcr.bazel.build/modules/rules_proto/7.0.2/MODULE.bazel": "bf81793bd6d2ad89a37a40693e56c61b0ee30f7a7fdbaf3eabbf5f39de47dea2", + "https://bcr.bazel.build/modules/rules_proto/7.0.2/source.json": "1e5e7260ae32ef4f2b52fd1d0de8d03b606a44c91b694d2f1afb1d3b28a48ce1", + "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f", + "https://bcr.bazel.build/modules/rules_python/0.23.1/MODULE.bazel": "49ffccf0511cb8414de28321f5fcf2a31312b47c40cc21577144b7447f2bf300", + "https://bcr.bazel.build/modules/rules_python/0.25.0/MODULE.bazel": "72f1506841c920a1afec76975b35312410eea3aa7b63267436bfb1dd91d2d382", + "https://bcr.bazel.build/modules/rules_python/0.28.0/MODULE.bazel": "cba2573d870babc976664a912539b320cbaa7114cd3e8f053c720171cde331ed", + "https://bcr.bazel.build/modules/rules_python/0.31.0/MODULE.bazel": "93a43dc47ee570e6ec9f5779b2e64c1476a6ce921c48cc9a1678a91dd5f8fd58", + "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c", + "https://bcr.bazel.build/modules/rules_python/0.40.0/MODULE.bazel": "9d1a3cd88ed7d8e39583d9ffe56ae8a244f67783ae89b60caafc9f5cf318ada7", + "https://bcr.bazel.build/modules/rules_python/0.40.0/source.json": "939d4bd2e3110f27bfb360292986bb79fd8dcefb874358ccd6cdaa7bda029320", + "https://bcr.bazel.build/modules/rules_shell/0.2.0/MODULE.bazel": "fda8a652ab3c7d8fee214de05e7a9916d8b28082234e8d2c0094505c5268ed3c", + "https://bcr.bazel.build/modules/rules_shell/0.3.0/MODULE.bazel": "de4402cd12f4cc8fda2354fce179fdb068c0b9ca1ec2d2b17b3e21b24c1a937b", + "https://bcr.bazel.build/modules/rules_shell/0.3.0/source.json": "c55ed591aa5009401ddf80ded9762ac32c358d2517ee7820be981e2de9756cf3", + "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8", + "https://bcr.bazel.build/modules/stardoc/0.5.3/MODULE.bazel": "c7f6948dae6999bf0db32c1858ae345f112cacf98f174c7a8bb707e41b974f1c", + "https://bcr.bazel.build/modules/stardoc/0.5.6/MODULE.bazel": "c43dabc564990eeab55e25ed61c07a1aadafe9ece96a4efabb3f8bf9063b71ef", + "https://bcr.bazel.build/modules/stardoc/0.7.0/MODULE.bazel": "05e3d6d30c099b6770e97da986c53bd31844d7f13d41412480ea265ac9e8079c", + "https://bcr.bazel.build/modules/stardoc/0.7.1/MODULE.bazel": "3548faea4ee5dda5580f9af150e79d0f6aea934fc60c1cc50f4efdd9420759e7", + "https://bcr.bazel.build/modules/stardoc/0.7.1/source.json": "b6500ffcd7b48cd72c29bb67bcac781e12701cc0d6d55d266a652583cfcdab01", + "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43", + "https://bcr.bazel.build/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0", + "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.5/MODULE.bazel": "eec517b5bbe5492629466e11dae908d043364302283de25581e3eb944326c4ca", + "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.5/source.json": "22bc55c47af97246cfc093d0acf683a7869377de362b5d1c552c2c2e16b7a806", + "https://bcr.bazel.build/modules/zlib/1.3.1/MODULE.bazel": "751c9940dcfe869f5f7274e1295422a34623555916eb98c174c1e945594bf198" + }, + "selectedYankedVersions": {}, + "moduleExtensions": { + "@@rules_kotlin+//src/main/starlark/core/repositories:bzlmod_setup.bzl%rules_kotlin_extensions": { + "general": { + "bzlTransitiveDigest": "rL/34P1aFDq2GqVC2zCFgQ8nTuOC6ziogocpvG50Qz8=", + "usagesDigest": "QI2z8ZUR+mqtbwsf2fLqYdJAkPOHdOV+tF2yVAUgRzw=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "com_github_jetbrains_kotlin_git": { + "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:compiler.bzl%kotlin_compiler_git_repository", + "attributes": { + "urls": [ + "https://github.com/JetBrains/kotlin/releases/download/v1.9.23/kotlin-compiler-1.9.23.zip" + ], + "sha256": "93137d3aab9afa9b27cb06a824c2324195c6b6f6179d8a8653f440f5bd58be88" + } + }, + "com_github_jetbrains_kotlin": { + "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:compiler.bzl%kotlin_capabilities_repository", + "attributes": { + "git_repository_name": "com_github_jetbrains_kotlin_git", + "compiler_version": "1.9.23" + } + }, + "com_github_google_ksp": { + "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:ksp.bzl%ksp_compiler_plugin_repository", + "attributes": { + "urls": [ + "https://github.com/google/ksp/releases/download/1.9.23-1.0.20/artifacts.zip" + ], + "sha256": "ee0618755913ef7fd6511288a232e8fad24838b9af6ea73972a76e81053c8c2d", + "strip_version": "1.9.23-1.0.20" + } + }, + "com_github_pinterest_ktlint": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file", + "attributes": { + "sha256": "01b2e0ef893383a50dbeb13970fe7fa3be36ca3e83259e01649945b09d736985", + "urls": [ + "https://github.com/pinterest/ktlint/releases/download/1.3.0/ktlint" + ], + "executable": true + } + }, + "rules_android": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "sha256": "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806", + "strip_prefix": "rules_android-0.1.1", + "urls": [ + "https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip" + ] + } + } + }, + "recordedRepoMappingEntries": [ + [ + "rules_kotlin+", + "bazel_tools", + "bazel_tools" + ] + ] + } + } + }, + "facts": {} +} diff --git a/README.md b/README.md index d802749c..ec6b2df2 100644 --- a/README.md +++ b/README.md @@ -4,26 +4,27 @@ This repository contains examples showing how to use [MapStruct](http://mapstruc Currently, the following examples exist: -* _mapstruct-on-ant_: Shows how to use MapStruct in Ant-based projects; to build this example, run `ant build` on the command line -* _mapstruct-on-gradle_: Shows how to use MapStruct in Gradle-based projects; to build the example project, run `./gradlew clean build` on the command line -* _mapstruct-lombok_: Shows how to use MapStruct together with Lombok (with both a Maven `pom.xml` and a Gradle `build.gradle`); to build the example project, run either `mvn clean install` or `./gradlew clean build` on the command line -* _mapstruct-iterable-non-iterable_: Shows how by means of a mapper util class conversions can be made from an iterable- to its non-iterable element -* _mapstruct-mapping-from-map_: Shows how by means of a mapper util class and qualifiers extracting value can be carried out on Maps. Watch [mapstruct/mapstruct#1075](https://github.com/mapstruct/mapstruct/issues/1075) for native support. -* _mapstruct-rounding_: Shows how by means of a mapper util class and qualifiers roundings can be carried out on Numbers -* _mapstruct-examples-updatemethods-1_: Shows how to update an existing target object -* _mapstruct-examples-field-mapping_: Shows how MapStruct can be used with "struct" like objects with public fields -* _mapstruct-nested-bean-mappings_: Shows how to map object graphs via a main root method -* _mapstruct-mapping-with-cycles_: Shows how to map object graphs that can contain cycles -* _mapstruct-spi-accessor-naming_: Example on how to use the Service Provider Interface (SPI) for a custom accessor naming strategy. -* _mapstruct-protobuf3_: Example on how to use protobuf3 with MapStruct -* _mapstruct-kotlin_: Example on how to use MapStruct with Kotlin using KAPT (Kotlin Annotation Processing Tool) -* _mapstruct-kotlin-gradle_: Example on how to use MapStruct with Kotlin and Gradle Kotlin DSL using KAPT -* _mapstruct-jpa-parent-child_: Example on how to use @Context in relation to parent / child relations in JPA) -* _mapstruct-suppress-unmapped_: Shows how mapping to target properties can be ignored without warning by default in a mixed scenario. However bean property mappings that have the same name will still be applied. -* _mapstruct-lookup-entity-with-composed-key_: Shows how an object with composite key can be read from the database in a mapping method. -* _mapstruct-clone_: Shows how an object can be deeply cloned by defining all mapping methods. -* _mapstruct-metadata-annotations_: Demonstrates how to read annotations and use them as mapping instruction. -* _mapstruct-mappers-repo_: Demonstrates how one can build a repo of mappers by means of code generation. +* [_mapstruct-on-ant_](mapstruct-on-ant): Shows how to use MapStruct in Ant-based projects; to build this example, run `ant build` on the command line +* [_mapstruct-on-gradle_](mapstruct-on-gradle): Shows how to use MapStruct in Gradle-based projects; to build the example project, run `./gradlew clean build` on the command line +* [_mapstruct-on-bazel_](mapstruct-on-bazel): Shows how to use MapStruct in Bazel-based projects; to build the example project, run `bazel build //...` on the command line, to test the project, run `bazel test //...`. +* [_mapstruct-lombok_](mapstruct-lombok): Shows how to use MapStruct together with Lombok (with both a Maven `pom.xml` and a Gradle `build.gradle`); to build the example project, run either `mvn clean install` or `./gradlew clean build` on the command line +* [_mapstruct-iterable-non-iterable_](mapstruct-iterable-to-non-iterable): Shows how by means of a mapper util class conversions can be made from an iterable- to its non-iterable element +* [_mapstruct-mapping-from-map_](mapstruct-mapping-from-map): Shows how by means of a mapper util class and qualifiers extracting value can be carried out on Maps. Watch [mapstruct/mapstruct#1075](https://github.com/mapstruct/mapstruct/issues/1075) for native support. +* [_mapstruct-rounding_](mapstruct-rounding): Shows how by means of a mapper util class and qualifiers roundings can be carried out on Numbers +* [_mapstruct-updatemethods_](mapstruct-updatemethods-1): Shows how to update an existing target object +* [_mapstruct-field-mapping_](mapstruct-field-mapping): Shows how MapStruct can be used with "struct" like objects with public fields +* [_mapstruct-nested-bean-mappings_](mapstruct-nested-bean-mappings): Shows how to map object graphs via a main root method +* [_mapstruct-mapping-with-cycles_](mapstruct-nested-bean-mappings): Shows how to map object graphs that can contain cycles +* [_mapstruct-spi-accessor-naming_](mapstruct-spi-accessor-naming): Example on how to use the Service Provider Interface (SPI) for a custom accessor naming strategy. +* [_mapstruct-protobuf3_](mapstruct-protobuf3): Example on how to use protobuf3 with MapStruct +* [_mapstruct-kotlin_](mapstruct-kotlin): Example on how to use MapStruct with Kotlin using KAPT (Kotlin Annotation Processing Tool) +* [_mapstruct-kotlin-gradle_](mapstruct-kotlin-gradle): Example on how to use MapStruct with Kotlin and Gradle Kotlin DSL using KAPT +* [_mapstruct-jpa-child-parent_](mapstruct-jpa-child-parent): Example on how to use @Context in relation to parent / child relations in JPA) +* [_mapstruct-suppress-unmapped_](mapstruct-suppress-unmapped): Shows how mapping to target properties can be ignored without warning by default in a mixed scenario. However bean property mappings that have the same name will still be applied. +* [_mapstruct-lookup-entity-with-id_](mapstruct-lookup-entity-with-id): Shows how an object with composite key can be read from the database in a mapping method. +* [_mapstruct-clone_](mapstruct-clone): Shows how an object can be deeply cloned by defining all mapping methods. +* [_mapstruct-metadata-annotations_](mapstruct-metadata-with-annotations): Demonstrates how to read annotations and use them as mapping instruction. +* [_mapstruct-mappers-repo_](mapstruct-mapper-repo): Demonstrates how one can build a repo of mappers by means of code generation. ## License diff --git a/WORKSPACE b/WORKSPACE new file mode 100644 index 00000000..42d95e50 --- /dev/null +++ b/WORKSPACE @@ -0,0 +1,2 @@ +# This project has been migrated to Bzlmod (MODULE.bazel) +# The WORKSPACE file is kept for compatibility but is no longer actively used diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index f3d88b1c..e708b1c0 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index b7c8c5db..db9a6b82 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 2fe81a7d..4f906e0c 100755 --- a/gradlew +++ b/gradlew @@ -82,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -129,6 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/gradlew.bat b/gradlew.bat index 62bd9b9c..107acd32 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -54,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -64,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/license.txt b/license.txt index f053dd8c..73ce4f8a 100644 --- a/license.txt +++ b/license.txt @@ -1,16 +1,3 @@ - Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - and/or other contributors as indicated by the @authors tag. See the - copyright.txt file in the distribution for a full listing of all - contributors. + Copyright MapStruct Authors. - The MapStruct Examples project is licensed under the Apache License, - Version 2.0 (the "License"); you may not use this software 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. + Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 diff --git a/mapstruct-clone/pom.xml b/mapstruct-clone/pom.xml index 34f2fad9..fe7bc83c 100644 --- a/mapstruct-clone/pom.xml +++ b/mapstruct-clone/pom.xml @@ -1,22 +1,9 @@ UTF-8 - 1.3.1.Final + 1.7.0.Beta1 org.mapstruct - mapstruct-jdk8 + mapstruct ${org.mapstruct.version} junit junit - 4.12 + 4.13.1 test org.assertj assertj-core - 3.6.2 + 3.27.7 test @@ -60,7 +47,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.14.1 1.8 1.8 diff --git a/mapstruct-clone/src/main/java/org/mapstruct/example/dto/CustomerDto.java b/mapstruct-clone/src/main/java/org/mapstruct/example/dto/CustomerDto.java index bf650bc8..3d3386e4 100644 --- a/mapstruct-clone/src/main/java/org/mapstruct/example/dto/CustomerDto.java +++ b/mapstruct-clone/src/main/java/org/mapstruct/example/dto/CustomerDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - *

- * Licensed 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. +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-clone/src/main/java/org/mapstruct/example/mapper/Cloner.java b/mapstruct-clone/src/main/java/org/mapstruct/example/mapper/Cloner.java index ed417787..4c3807d7 100644 --- a/mapstruct-clone/src/main/java/org/mapstruct/example/mapper/Cloner.java +++ b/mapstruct-clone/src/main/java/org/mapstruct/example/mapper/Cloner.java @@ -1,31 +1,13 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - *

- * Licensed 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. +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.mapper; -import java.util.List; -import java.util.Map; - -import org.mapstruct.InheritInverseConfiguration; import org.mapstruct.Mapper; +import org.mapstruct.control.DeepClone; import org.mapstruct.example.dto.CustomerDto; -import org.mapstruct.example.dto.OrderItemDto; -import org.mapstruct.example.dto.OrderItemKeyDto; import org.mapstruct.factory.Mappers; /** @@ -34,18 +16,10 @@ * By defining all methods, we force MapStruct to generate new objects for each mapper in stead of * taking shortcuts by mapping an object directly. */ -@Mapper +@Mapper(mappingControl = DeepClone.class) public interface Cloner { Cloner MAPPER = Mappers.getMapper( Cloner.class ); CustomerDto clone(CustomerDto customerDto); - - List clone(List orders); - - OrderItemDto clone(OrderItemDto order); - - Map clone(Map stock); - - OrderItemKeyDto clone( OrderItemKeyDto orderItemKeyDto ); } diff --git a/mapstruct-clone/src/test/java/org/mapstruct/example/ClonerTest.java b/mapstruct-clone/src/test/java/org/mapstruct/example/ClonerTest.java index 136929fd..3db410cd 100644 --- a/mapstruct-clone/src/test/java/org/mapstruct/example/ClonerTest.java +++ b/mapstruct-clone/src/test/java/org/mapstruct/example/ClonerTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; diff --git a/mapstruct-field-mapping/pom.xml b/mapstruct-field-mapping/pom.xml index ce16c3b3..d56f7a00 100644 --- a/mapstruct-field-mapping/pom.xml +++ b/mapstruct-field-mapping/pom.xml @@ -1,22 +1,9 @@ UTF-8 - 1.3.1.Final + 1.7.0.Beta1 @@ -51,14 +38,14 @@ junit junit - 4.12 + 4.13.1 test org.assertj assertj-core - 3.6.2 + 3.27.7 test @@ -69,7 +56,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.14.1 1.8 1.8 diff --git a/mapstruct-field-mapping/src/main/java/org/mapstruct/example/dto/Customer.java b/mapstruct-field-mapping/src/main/java/org/mapstruct/example/dto/Customer.java index 92955700..3365a291 100644 --- a/mapstruct-field-mapping/src/main/java/org/mapstruct/example/dto/Customer.java +++ b/mapstruct-field-mapping/src/main/java/org/mapstruct/example/dto/Customer.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - *

- * Licensed 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. +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-field-mapping/src/main/java/org/mapstruct/example/dto/CustomerDto.java b/mapstruct-field-mapping/src/main/java/org/mapstruct/example/dto/CustomerDto.java index 7537a61d..630623dd 100644 --- a/mapstruct-field-mapping/src/main/java/org/mapstruct/example/dto/CustomerDto.java +++ b/mapstruct-field-mapping/src/main/java/org/mapstruct/example/dto/CustomerDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - *

- * Licensed 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. +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-field-mapping/src/main/java/org/mapstruct/example/mapper/CustomerMapper.java b/mapstruct-field-mapping/src/main/java/org/mapstruct/example/mapper/CustomerMapper.java index 817f6592..869f28ec 100644 --- a/mapstruct-field-mapping/src/main/java/org/mapstruct/example/mapper/CustomerMapper.java +++ b/mapstruct-field-mapping/src/main/java/org/mapstruct/example/mapper/CustomerMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - *

- * Licensed 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. +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.mapper; @@ -33,8 +20,8 @@ public interface CustomerMapper { CustomerMapper MAPPER = Mappers.getMapper( CustomerMapper.class ); - @Mapping(source = "orders", target = "orderItems") - @Mapping(source = "customerName", target = "name") + @Mapping(target = "orderItems", source = "orders") + @Mapping(target = "name", source = "customerName") Customer toCustomer(CustomerDto customerDto); @InheritInverseConfiguration diff --git a/mapstruct-field-mapping/src/main/java/org/mapstruct/example/mapper/OrderItemMapper.java b/mapstruct-field-mapping/src/main/java/org/mapstruct/example/mapper/OrderItemMapper.java index 43868eb1..16914a28 100644 --- a/mapstruct-field-mapping/src/main/java/org/mapstruct/example/mapper/OrderItemMapper.java +++ b/mapstruct-field-mapping/src/main/java/org/mapstruct/example/mapper/OrderItemMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - *

- * Licensed 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. +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.mapper; diff --git a/mapstruct-field-mapping/src/test/java/org/mapstruct/example/CustomerMapperTest.java b/mapstruct-field-mapping/src/test/java/org/mapstruct/example/CustomerMapperTest.java index 5aaf5f19..2c2aa2da 100644 --- a/mapstruct-field-mapping/src/test/java/org/mapstruct/example/CustomerMapperTest.java +++ b/mapstruct-field-mapping/src/test/java/org/mapstruct/example/CustomerMapperTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; diff --git a/mapstruct-iterable-to-non-iterable/pom.xml b/mapstruct-iterable-to-non-iterable/pom.xml index b2895d5b..bf2c3293 100644 --- a/mapstruct-iterable-to-non-iterable/pom.xml +++ b/mapstruct-iterable-to-non-iterable/pom.xml @@ -1,22 +1,9 @@ @@ -36,20 +23,20 @@ org.mapstruct mapstruct - 1.3.1.Final + 1.7.0.Beta1 org.mapstruct mapstruct-processor - 1.3.1.Final + 1.7.0.Beta1 provided junit junit - 4.12 + 4.13.1 test @@ -61,7 +48,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.14.1 org.mapstruct.ap.MappingProcessor diff --git a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Main.java b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Main.java index 68659e45..4d26e920 100644 --- a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Main.java +++ b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Main.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package com.mycompany.mapper; diff --git a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Source.java b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Source.java index 47a2275c..d70abada 100644 --- a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Source.java +++ b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Source.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package com.mycompany.mapper; diff --git a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/SourceTargetMapper.java b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/SourceTargetMapper.java index a70fd377..34401eba 100644 --- a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/SourceTargetMapper.java +++ b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/SourceTargetMapper.java @@ -1,37 +1,24 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package com.mycompany.mapper; import com.mycompany.mapper.util.FirstElement; -import com.mycompany.mapper.util.IterableNonInterableUtil; +import com.mycompany.mapper.util.IterableNonIterableUtil; import com.mycompany.mapper.util.LastElement; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; -@Mapper( uses = IterableNonInterableUtil.class ) +@Mapper( uses = IterableNonIterableUtil.class ) public interface SourceTargetMapper { SourceTargetMapper MAPPER = Mappers.getMapper( SourceTargetMapper.class ); - @Mapping( source = "myIntegers", target = "myInteger", qualifiedBy = FirstElement.class ) - @Mapping( source = "myStrings", target = "myString", qualifiedBy = LastElement.class ) + @Mapping( target = "myInteger", source = "myIntegers", qualifiedBy = FirstElement.class ) + @Mapping( target = "myString", source = "myStrings", qualifiedBy = LastElement.class ) Target toTarget( Source s ); } diff --git a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Target.java b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Target.java index 78604a19..1cfc37d4 100644 --- a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Target.java +++ b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/Target.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package com.mycompany.mapper; diff --git a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/FirstElement.java b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/FirstElement.java index bd4461d6..8b2c59b9 100644 --- a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/FirstElement.java +++ b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/FirstElement.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package com.mycompany.mapper.util; diff --git a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/IterableNonInterableUtil.java b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/IterableNonInterableUtil.java deleted file mode 100644 index 82d8ab74..00000000 --- a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/IterableNonInterableUtil.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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. - */ -package com.mycompany.mapper.util; - -import java.util.List; -//import org.mapstruct.ap.test.selection.qualifier.annotation.TitleTranslator; - -/** - * - * @author Sjaak Derksen - */ -public class IterableNonInterableUtil { - - @FirstElement - public T first( List in ) { - if ( in != null && !in.isEmpty() ) { - return in.get( 0 ); - } - else { - return null; - } - } - - @LastElement - public T last( List in ) { - if ( in != null && !in.isEmpty() ) { - return in.get( in.size() - 1 ); - } - else { - return null; - } - } - - -} diff --git a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/IterableNonIterableUtil.java b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/IterableNonIterableUtil.java new file mode 100644 index 00000000..1db01f88 --- /dev/null +++ b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/IterableNonIterableUtil.java @@ -0,0 +1,38 @@ +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 + */ +package com.mycompany.mapper.util; + +import java.util.List; +//import org.mapstruct.ap.test.selection.qualifier.annotation.TitleTranslator; + +/** + * + * @author Sjaak Derksen + */ +public class IterableNonIterableUtil { + + @FirstElement + public T first( List in ) { + if ( in != null && !in.isEmpty() ) { + return in.get( 0 ); + } + else { + return null; + } + } + + @LastElement + public T last( List in ) { + if ( in != null && !in.isEmpty() ) { + return in.get( in.size() - 1 ); + } + else { + return null; + } + } + + +} diff --git a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/LastElement.java b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/LastElement.java index 835cccd7..ed402416 100644 --- a/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/LastElement.java +++ b/mapstruct-iterable-to-non-iterable/src/main/java/com/mycompany/mapper/util/LastElement.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package com.mycompany.mapper.util; diff --git a/mapstruct-iterable-to-non-iterable/src/test/java/com/mycompany/mapper/SourceTargetMapperTest.java b/mapstruct-iterable-to-non-iterable/src/test/java/com/mycompany/mapper/SourceTargetMapperTest.java index dc2d77e3..07b5f1d4 100644 --- a/mapstruct-iterable-to-non-iterable/src/test/java/com/mycompany/mapper/SourceTargetMapperTest.java +++ b/mapstruct-iterable-to-non-iterable/src/test/java/com/mycompany/mapper/SourceTargetMapperTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package com.mycompany.mapper; diff --git a/mapstruct-jpa-child-parent/pom.xml b/mapstruct-jpa-child-parent/pom.xml index be89699f..7c3ddf2e 100644 --- a/mapstruct-jpa-child-parent/pom.xml +++ b/mapstruct-jpa-child-parent/pom.xml @@ -1,22 +1,9 @@ @@ -27,7 +14,7 @@ UTF-8 - 1.3.1.Final + 1.7.0.Beta1 1.8 1.8 @@ -55,14 +42,14 @@ junit junit - 4.12 + 4.13.1 test org.assertj assertj-core - 3.9.0 + 3.27.7 test @@ -73,7 +60,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.14.1 diff --git a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ChildDto.java b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ChildDto.java index 7b26873a..0fbea00d 100644 --- a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ChildDto.java +++ b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ChildDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ChildEntity.java b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ChildEntity.java index bd9780da..f41fb0a3 100644 --- a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ChildEntity.java +++ b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ChildEntity.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/JpaContext.java b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/JpaContext.java index 514269ee..3aecfd7b 100644 --- a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/JpaContext.java +++ b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/JpaContext.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ParentDto.java b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ParentDto.java index d427efb5..339ef89e 100644 --- a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ParentDto.java +++ b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ParentDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ParentEntity.java b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ParentEntity.java index f349ae38..f6c5a38b 100644 --- a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ParentEntity.java +++ b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/ParentEntity.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java index 02bc4dd5..2bb54a32 100644 --- a/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java +++ b/mapstruct-jpa-child-parent/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-jpa-child-parent/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java b/mapstruct-jpa-child-parent/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java index 4c57233d..4d6949b5 100644 --- a/mapstruct-jpa-child-parent/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java +++ b/mapstruct-jpa-child-parent/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-kotlin-gradle/build.gradle.kts b/mapstruct-kotlin-gradle/build.gradle.kts index b3d4171a..9aee9753 100644 --- a/mapstruct-kotlin-gradle/build.gradle.kts +++ b/mapstruct-kotlin-gradle/build.gradle.kts @@ -1,31 +1,43 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile plugins { - kotlin("jvm") version "1.3.61" - kotlin("kapt") version "1.3.61" + kotlin("jvm") version "1.9.10" + kotlin("kapt") version "1.9.10" } group = "org.mapstruct.examples" version = "1.0.0-SNAPSHOT" +java.sourceCompatibility = org.gradle.api.JavaVersion.VERSION_1_8 + repositories { mavenCentral() } dependencies { implementation(kotlin("stdlib-jdk8")) - implementation("org.mapstruct:mapstruct:1.3.1.Final") - kapt("org.mapstruct:mapstruct-processor:1.3.1.Final") + implementation("org.mapstruct:mapstruct:1.7.0.Beta1") + kapt("org.mapstruct:mapstruct-processor:1.7.0.Beta1") testImplementation("org.junit.jupiter:junit-jupiter-api:5.3.1") testImplementation("org.junit.jupiter:junit-jupiter-engine:5.3.1") testImplementation("org.assertj:assertj-core:3.11.1") } + +kapt { + arguments { + // Set Mapstruct Configuration options here + // https://kotlinlang.org/docs/reference/kapt.html#annotation-processor-arguments + // https://mapstruct.org/documentation/stable/reference/html/#configuration-options + // arg("mapstruct.defaultComponentModel", "spring") + } +} + tasks.withType { kotlinOptions.jvmTarget = "1.8" } val test by tasks.getting(Test::class) { useJUnitPlatform { } -} \ No newline at end of file +} diff --git a/mapstruct-kotlin-gradle/gradle/wrapper/gradle-wrapper.jar b/mapstruct-kotlin-gradle/gradle/wrapper/gradle-wrapper.jar index 1948b907..e708b1c0 100644 Binary files a/mapstruct-kotlin-gradle/gradle/wrapper/gradle-wrapper.jar and b/mapstruct-kotlin-gradle/gradle/wrapper/gradle-wrapper.jar differ diff --git a/mapstruct-kotlin-gradle/gradle/wrapper/gradle-wrapper.properties b/mapstruct-kotlin-gradle/gradle/wrapper/gradle-wrapper.properties index b7c8c5db..db9a6b82 100644 --- a/mapstruct-kotlin-gradle/gradle/wrapper/gradle-wrapper.properties +++ b/mapstruct-kotlin-gradle/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/mapstruct-kotlin-gradle/gradlew b/mapstruct-kotlin-gradle/gradlew index cccdd3d5..4f906e0c 100755 --- a/mapstruct-kotlin-gradle/gradlew +++ b/mapstruct-kotlin-gradle/gradlew @@ -1,5 +1,21 @@ #!/usr/bin/env sh +# +# Copyright 2015 the original author or authors. +# +# Licensed 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 +# +# https://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. +# + ############################################################################## ## ## Gradle start up script for UN*X @@ -28,7 +44,7 @@ APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" @@ -66,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -109,10 +126,11 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath @@ -138,19 +156,19 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi @@ -159,14 +177,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/mapstruct-kotlin-gradle/gradlew.bat b/mapstruct-kotlin-gradle/gradlew.bat index f9553162..107acd32 100644 --- a/mapstruct-kotlin-gradle/gradlew.bat +++ b/mapstruct-kotlin-gradle/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -13,15 +29,18 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/converter/PersonConverter.kt b/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/converter/PersonConverter.kt index 9f9186cc..4f009cec 100644 --- a/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/converter/PersonConverter.kt +++ b/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/converter/PersonConverter.kt @@ -9,7 +9,7 @@ import org.mapstruct.example.kotlin.model.Person @Mapper interface PersonConverter { - @Mapping(source = "phoneNumber", target = "phone") + @Mapping(target = "phone", source = "phoneNumber") fun convertToDto(person: Person): PersonDto @InheritInverseConfiguration diff --git a/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/dto/PersonDto.kt b/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/dto/PersonDto.kt index c42402da..c6080361 100644 --- a/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/dto/PersonDto.kt +++ b/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/dto/PersonDto.kt @@ -2,9 +2,4 @@ package org.mapstruct.example.kotlin.dto import java.time.LocalDate -data class PersonDto(var firstName: String?, var lastName: String?, var phone: String?, var birthdate: LocalDate?) { - - // Necessary for MapStruct - constructor() : this(null, null, null, null) - -} +data class PersonDto(var firstName: String?, var lastName: String?, var phone: String?, var birthdate: LocalDate?) diff --git a/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/model/Person.kt b/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/model/Person.kt index af6086b3..ca3ad1ef 100644 --- a/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/model/Person.kt +++ b/mapstruct-kotlin-gradle/src/main/kotlin/org/mapstruct/example/kotlin/model/Person.kt @@ -2,9 +2,4 @@ package org.mapstruct.example.kotlin.model import java.time.LocalDate -data class Person(var firstName: String?, var lastName: String?, var phoneNumber: String?, var birthdate: LocalDate?) { - - // Necessary for MapStruct - constructor() : this(null, null, null, null) - -} +data class Person(var firstName: String?, var lastName: String?, var phoneNumber: String?, var birthdate: LocalDate?) diff --git a/mapstruct-kotlin/README.md b/mapstruct-kotlin/README.md index ea2790ba..15c954ee 100644 --- a/mapstruct-kotlin/README.md +++ b/mapstruct-kotlin/README.md @@ -7,17 +7,11 @@ Example usage of MapStruct and Kotlin with JDK-8 Bytecode. This is achieved by u In this example we want to map between a Person (Model) and a PersonDto (DTO). ```kotlin -data class Person(var firstName: String?, var lastName: String?, var phoneNumber: String?, var birthdate: LocalDate?) { - // Necessary for MapStruct - constructor() : this(null, null, null, null) -} +data class Person(var firstName: String?, var lastName: String?, var phoneNumber: String?, var birthdate: LocalDate?) ``` ```kotlin -data class PersonDto(var firstName: String?, var lastName: String?, var phone: String?, var birthdate: LocalDate?) { - // Necessary for MapStruct - constructor() : this(null, null, null, null) -} +data class PersonDto(var firstName: String?, var lastName: String?, var phone: String?, var birthdate: LocalDate?) ``` The MapStruct converter: @@ -26,7 +20,7 @@ The MapStruct converter: @Mapper interface PersonConverter { - @Mapping(source = "phoneNumber", target = "phone") + @Mapping(target = "phone", source = "phoneNumber") fun convertToDto(person: Person) : PersonDto @InheritInverseConfiguration diff --git a/mapstruct-kotlin/pom.xml b/mapstruct-kotlin/pom.xml index 72b20252..6919a6a3 100644 --- a/mapstruct-kotlin/pom.xml +++ b/mapstruct-kotlin/pom.xml @@ -9,14 +9,12 @@ 1.0.0-SNAPSHOT jar - Sample application demonstration the use of MapStruct and Kotlin - UTF-8 - 1.2.51 + 2.3.0 1.8 - 1.3.1.Final + 1.7.0.Beta1 @@ -40,13 +38,13 @@ junit junit - 4.12 + 4.13.1 test org.assertj assertj-core - 3.8.0 + 3.27.7 test @@ -77,6 +75,11 @@ mapstruct-processor ${mapstruct.version} + + org.jetbrains.kotlin + kotlin-metadata-jvm + ${kotlin.version} + @@ -100,7 +103,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.14.1 none ${kotlin.compiler.jvmTarget} diff --git a/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/converter/PersonConverter.kt b/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/converter/PersonConverter.kt index 9f9186cc..4f009cec 100644 --- a/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/converter/PersonConverter.kt +++ b/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/converter/PersonConverter.kt @@ -9,7 +9,7 @@ import org.mapstruct.example.kotlin.model.Person @Mapper interface PersonConverter { - @Mapping(source = "phoneNumber", target = "phone") + @Mapping(target = "phone", source = "phoneNumber") fun convertToDto(person: Person): PersonDto @InheritInverseConfiguration diff --git a/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/dto/PersonDto.kt b/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/dto/PersonDto.kt index c42402da..c6080361 100644 --- a/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/dto/PersonDto.kt +++ b/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/dto/PersonDto.kt @@ -2,9 +2,4 @@ package org.mapstruct.example.kotlin.dto import java.time.LocalDate -data class PersonDto(var firstName: String?, var lastName: String?, var phone: String?, var birthdate: LocalDate?) { - - // Necessary for MapStruct - constructor() : this(null, null, null, null) - -} +data class PersonDto(var firstName: String?, var lastName: String?, var phone: String?, var birthdate: LocalDate?) diff --git a/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/model/Person.kt b/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/model/Person.kt index af6086b3..ca3ad1ef 100644 --- a/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/model/Person.kt +++ b/mapstruct-kotlin/src/main/kotlin/org/mapstruct/example/kotlin/model/Person.kt @@ -2,9 +2,4 @@ package org.mapstruct.example.kotlin.model import java.time.LocalDate -data class Person(var firstName: String?, var lastName: String?, var phoneNumber: String?, var birthdate: LocalDate?) { - - // Necessary for MapStruct - constructor() : this(null, null, null, null) - -} +data class Person(var firstName: String?, var lastName: String?, var phoneNumber: String?, var birthdate: LocalDate?) diff --git a/mapstruct-lombok/build.gradle b/mapstruct-lombok/build.gradle index 3df8b96b..67efc56c 100644 --- a/mapstruct-lombok/build.gradle +++ b/mapstruct-lombok/build.gradle @@ -8,14 +8,21 @@ repositories { } ext { - mapstructVersion = "1.3.1.Final" - lombokVersion = "1.18.12" + mapstructVersion = "1.7.0.Beta1" + lombokVersion = "1.18.30" + lombokMapstructBindingVersion = "0.2.0" } sourceCompatibility = JavaVersion.VERSION_1_8 dependencies { implementation "org.mapstruct:mapstruct:${mapstructVersion}", "org.projectlombok:lombok:${lombokVersion}" - testImplementation 'junit:junit:4.12' - annotationProcessor "org.mapstruct:mapstruct-processor:${mapstructVersion}", "org.projectlombok:lombok:${lombokVersion}" + testImplementation 'junit:junit:4.13.1' + + /* + this example uses lombok directly over the annotationProcessor, + the io.freefair.lombok plugin works as well. + The freefair-lombok plugin is used in the example mapstruct-on-gradle-testcp-with-lombok + */ + annotationProcessor "org.mapstruct:mapstruct-processor:${mapstructVersion}", "org.projectlombok:lombok:${lombokVersion}", "org.projectlombok:lombok-mapstruct-binding:${lombokMapstructBindingVersion}" } diff --git a/mapstruct-lombok/gradle/wrapper/gradle-wrapper.jar b/mapstruct-lombok/gradle/wrapper/gradle-wrapper.jar index 05ef575b..e708b1c0 100644 Binary files a/mapstruct-lombok/gradle/wrapper/gradle-wrapper.jar and b/mapstruct-lombok/gradle/wrapper/gradle-wrapper.jar differ diff --git a/mapstruct-lombok/gradle/wrapper/gradle-wrapper.properties b/mapstruct-lombok/gradle/wrapper/gradle-wrapper.properties index b7c8c5db..db9a6b82 100644 --- a/mapstruct-lombok/gradle/wrapper/gradle-wrapper.properties +++ b/mapstruct-lombok/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/mapstruct-lombok/gradlew b/mapstruct-lombok/gradlew index 9d82f789..4f906e0c 100755 --- a/mapstruct-lombok/gradlew +++ b/mapstruct-lombok/gradlew @@ -1,4 +1,20 @@ -#!/usr/bin/env bash +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed 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 +# +# https://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. +# ############################################################################## ## @@ -6,20 +22,38 @@ ## ############################################################################## -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null APP_NAME="Gradle" APP_BASE_NAME=`basename "$0"` +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -30,6 +64,7 @@ die ( ) { cygwin=false msys=false darwin=false +nonstop=false case "`uname`" in CYGWIN* ) cygwin=true @@ -40,28 +75,14 @@ case "`uname`" in MINGW* ) msys=true ;; + NONSTOP* ) + nonstop=true + ;; esac -# Attempt to set APP_HOME -# Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null - CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -85,7 +106,7 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then MAX_FD_LIMIT=`ulimit -H -n` if [ $? -eq 0 ] ; then if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then @@ -105,10 +126,11 @@ if $darwin; then GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" fi -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath @@ -134,27 +156,30 @@ if $cygwin ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi -# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules -function splitJvmOpts() { - JVM_OPTS=("$@") +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " } -eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS -JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" +exec "$JAVACMD" "$@" diff --git a/mapstruct-lombok/gradlew.bat b/mapstruct-lombok/gradlew.bat index 8a0b282a..107acd32 100644 --- a/mapstruct-lombok/gradlew.bat +++ b/mapstruct-lombok/gradlew.bat @@ -1,3 +1,19 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + @if "%DEBUG%" == "" @echo off @rem ########################################################################## @rem @@ -8,20 +24,23 @@ @rem Set local scope for the variables with windows NT shell if "%OS%"=="Windows_NT" setlocal -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - set DIRNAME=%~dp0 if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + @rem Find java.exe if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -35,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -45,34 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windowz variants - -if not "%OS%" == "Windows_NT" goto win9xME_args -if "%@eval[2+2]" == "4" goto 4NT_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* -goto execute - -:4NT_args -@rem Get arguments from the 4NT Shell from JP Software -set CMD_LINE_ARGS=%$ - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/mapstruct-lombok/pom.xml b/mapstruct-lombok/pom.xml index 2d597d5b..f29a0a4a 100644 --- a/mapstruct-lombok/pom.xml +++ b/mapstruct-lombok/pom.xml @@ -1,22 +1,9 @@ @@ -31,8 +18,9 @@ UTF-8 1.8 1.8 - 1.3.1.Final - 1.18.12 + 1.7.0.Beta1 + 1.18.30 + 0.2.0 @@ -63,7 +51,7 @@ junit junit test - 4.12 + 4.13.1 @@ -73,7 +61,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.14.1 1.8 1.8 @@ -95,6 +83,11 @@ lombok ${org.projectlombok.version} + + org.projectlombok + lombok-mapstruct-binding + ${lombok-mapstruct-binding.version} + diff --git a/mapstruct-lombok/src/main/java/com/mycompany/dto/Source.java b/mapstruct-lombok/src/main/java/com/mycompany/dto/Source.java index c4aada7a..dc4f0cd9 100644 --- a/mapstruct-lombok/src/main/java/com/mycompany/dto/Source.java +++ b/mapstruct-lombok/src/main/java/com/mycompany/dto/Source.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package com.mycompany.dto; diff --git a/mapstruct-lombok/src/main/java/com/mycompany/entities/Target.java b/mapstruct-lombok/src/main/java/com/mycompany/entities/Target.java index afc3d0c5..223a8860 100644 --- a/mapstruct-lombok/src/main/java/com/mycompany/entities/Target.java +++ b/mapstruct-lombok/src/main/java/com/mycompany/entities/Target.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package com.mycompany.entities; diff --git a/mapstruct-lombok/src/main/java/com/mycompany/mapper/Main.java b/mapstruct-lombok/src/main/java/com/mycompany/mapper/Main.java index 1956327c..a8fd6b3d 100644 --- a/mapstruct-lombok/src/main/java/com/mycompany/mapper/Main.java +++ b/mapstruct-lombok/src/main/java/com/mycompany/mapper/Main.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package com.mycompany.mapper; diff --git a/mapstruct-lombok/src/main/java/com/mycompany/mapper/SourceTargetMapper.java b/mapstruct-lombok/src/main/java/com/mycompany/mapper/SourceTargetMapper.java index 33cc99c1..bf3ae459 100644 --- a/mapstruct-lombok/src/main/java/com/mycompany/mapper/SourceTargetMapper.java +++ b/mapstruct-lombok/src/main/java/com/mycompany/mapper/SourceTargetMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package com.mycompany.mapper; @@ -30,6 +17,6 @@ public interface SourceTargetMapper { SourceTargetMapper MAPPER = Mappers.getMapper( SourceTargetMapper.class ); - @Mapping( source = "test", target = "testing" ) + @Mapping( target = "testing", source = "test" ) Target toTarget( Source s ); } diff --git a/mapstruct-lombok/src/test/java/com/mycompany/mapper/SourceTargetMapperTest.java b/mapstruct-lombok/src/test/java/com/mycompany/mapper/SourceTargetMapperTest.java index 49f57c15..4110d79e 100644 --- a/mapstruct-lombok/src/test/java/com/mycompany/mapper/SourceTargetMapperTest.java +++ b/mapstruct-lombok/src/test/java/com/mycompany/mapper/SourceTargetMapperTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package com.mycompany.mapper; diff --git a/mapstruct-lookup-entity-with-id/pom.xml b/mapstruct-lookup-entity-with-id/pom.xml index b8e7eb45..b7b7e946 100644 --- a/mapstruct-lookup-entity-with-id/pom.xml +++ b/mapstruct-lookup-entity-with-id/pom.xml @@ -1,22 +1,9 @@ @@ -27,7 +14,7 @@ UTF-8 - 1.3.1.Final + 1.7.0.Beta1 @@ -53,14 +40,14 @@ junit junit - 4.12 + 4.13.1 test org.assertj assertj-core - 3.9.0 + 3.27.7 test @@ -71,7 +58,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.14.1 1.8 1.8 diff --git a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ArticleRepository.java b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ArticleRepository.java index 1fea0b5d..139e7e93 100644 --- a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ArticleRepository.java +++ b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ArticleRepository.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/CombinedOfferingEntity.java b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/CombinedOfferingEntity.java index 03cfc991..77660458 100644 --- a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/CombinedOfferingEntity.java +++ b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/CombinedOfferingEntity.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ComposedKey.java b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ComposedKey.java index 3e1bab20..65ae07a5 100644 --- a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ComposedKey.java +++ b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ComposedKey.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/Entity.java b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/Entity.java index a52c784d..e9e34bb4 100644 --- a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/Entity.java +++ b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/Entity.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java index cd187f5c..e2cd10ff 100644 --- a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java +++ b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ToothPaste.java b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ToothPaste.java index 692a4b34..43ded1d9 100644 --- a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ToothPaste.java +++ b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/ToothPaste.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/Toothbrush.java b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/Toothbrush.java index 01a71ffc..59f667e1 100644 --- a/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/Toothbrush.java +++ b/mapstruct-lookup-entity-with-id/src/main/java/org/mapstruct/jpa/Toothbrush.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-lookup-entity-with-id/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java b/mapstruct-lookup-entity-with-id/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java index 8e760cca..dfde755d 100644 --- a/mapstruct-lookup-entity-with-id/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java +++ b/mapstruct-lookup-entity-with-id/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/CarMapper.java b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/CarMapper.java index c0d9f7fb..b2d24a70 100755 --- a/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/CarMapper.java +++ b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/CarMapper.java @@ -19,6 +19,6 @@ @Mapper(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE) public interface CarMapper extends StandardMapper { - @Mapping(source = "numberOfSeats", target = "seatCount") + @Mapping(target = "seatCount", source = "numberOfSeats") CarDto map(Car Car); } \ No newline at end of file diff --git a/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/PersonMapper.java b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/PersonMapper.java index aa58cead..68e1707f 100755 --- a/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/PersonMapper.java +++ b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/PersonMapper.java @@ -18,6 +18,6 @@ @Mapper public interface PersonMapper extends StandardMapper { - @Mapping(source = "firstName", target = "name") + @Mapping(target = "name", source = "firstName") Employee map(Person p); } \ No newline at end of file diff --git a/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/PersonToBossMapper.java b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/PersonToBossMapper.java index 497f0485..8f7616fb 100755 --- a/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/PersonToBossMapper.java +++ b/mapstruct-mapper-repo/example/src/main/java/org/mapstruct/example/repo/mappers/PersonToBossMapper.java @@ -18,7 +18,7 @@ @Mapper public interface PersonToBossMapper extends StandardMapper { - @Mapping(source = "firstName", target = "name") + @Mapping(target = "name", source = "firstName") @Mapping(target = "title", constant = "Boss") Boss map(Person p); } \ No newline at end of file diff --git a/mapstruct-mapper-repo/pom.xml b/mapstruct-mapper-repo/pom.xml index 5e87d0aa..b1f3705d 100755 --- a/mapstruct-mapper-repo/pom.xml +++ b/mapstruct-mapper-repo/pom.xml @@ -10,7 +10,7 @@ UTF-8 - 1.3.1.Final + 1.7.0.Beta1 @@ -51,7 +51,7 @@ junit junit - 4.12 + 4.13.1 test @@ -64,7 +64,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.14.1 1.8 1.8 diff --git a/mapstruct-mapping-from-map/pom.xml b/mapstruct-mapping-from-map/pom.xml index 434305c2..95bec89f 100644 --- a/mapstruct-mapping-from-map/pom.xml +++ b/mapstruct-mapping-from-map/pom.xml @@ -1,22 +1,9 @@ @@ -27,7 +14,7 @@ UTF-8 - 1.3.1.Final + 1.7.0.Beta1 @@ -50,7 +37,7 @@ junit junit - 4.12 + 4.13.1 test @@ -61,7 +48,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.14.1 1.8 1.8 diff --git a/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/dto/Department.java b/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/dto/Department.java new file mode 100644 index 00000000..42ccd612 --- /dev/null +++ b/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/dto/Department.java @@ -0,0 +1,31 @@ +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 + */ +package org.mapstruct.example.dto; + +/** + * @author Filip Hrisafov + */ +public class Department { + + private String id; + private String name; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } +} diff --git a/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/dto/Employee.java b/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/dto/Employee.java new file mode 100644 index 00000000..907e710e --- /dev/null +++ b/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/dto/Employee.java @@ -0,0 +1,40 @@ +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 + */ +package org.mapstruct.example.dto; + +/** + * @author Filip Hrisafov + */ +public class Employee { + + private String id; + private String name; + private Department department; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Department getDepartment() { + return department; + } + + public void setDepartment(Department department) { + this.department = department; + } +} diff --git a/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/dto/Source.java b/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/dto/Source.java index 541ccfaf..7a66a372 100644 --- a/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/dto/Source.java +++ b/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/dto/Source.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/dto/Target.java b/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/dto/Target.java index e6043d4c..f37a6d75 100644 --- a/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/dto/Target.java +++ b/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/dto/Target.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/mapper/MapToBeanMapper.java b/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/mapper/MapToBeanMapper.java new file mode 100644 index 00000000..da365dc3 --- /dev/null +++ b/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/mapper/MapToBeanMapper.java @@ -0,0 +1,38 @@ +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 + */ +package org.mapstruct.example.mapper; + +import java.lang.annotation.Target; +import java.util.Map; + +import org.mapstruct.AfterMapping; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.MappingTarget; +import org.mapstruct.example.dto.Department; +import org.mapstruct.example.dto.Employee; +import org.mapstruct.factory.Mappers; + +/** + * @author Filip Hrisafov + */ +@Mapper +public interface MapToBeanMapper { + + MapToBeanMapper INSTANCE = Mappers.getMapper(MapToBeanMapper.class); + + @Mapping(target = "department", ignore = true) + Employee fromMap(Map map); + + @AfterMapping + default void finishEmployee(@MappingTarget Employee employee, Map map) { + employee.setDepartment(fromMapToDepartment(map)); + } + + @Mapping(target = "id", source = "did") + @Mapping(target = "name", source = "dname") + Department fromMapToDepartment(Map map); +} diff --git a/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/mapper/SourceTargetMapper.java b/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/mapper/SourceTargetMapper.java index 42bc5fe1..299d5a9d 100644 --- a/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/mapper/SourceTargetMapper.java +++ b/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/mapper/SourceTargetMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.mapper; @@ -37,7 +24,7 @@ public interface SourceTargetMapper { SourceTargetMapper MAPPER = Mappers.getMapper( SourceTargetMapper.class ); - @Mapping(source = "map", target = "ip", qualifiedBy = Ip.class ) - @Mapping(source = "map", target = "server", qualifiedBy = Server.class ) + @Mapping(target = "ip", source = "map", qualifiedBy = Ip.class ) + @Mapping(target = "server", source = "map", qualifiedBy = Server.class ) Target toTarget(Source s); } diff --git a/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/mapper/util/MappingUtil.java b/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/mapper/util/MappingUtil.java index e6af9b59..a0887df0 100644 --- a/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/mapper/util/MappingUtil.java +++ b/mapstruct-mapping-from-map/src/main/java/org/mapstruct/example/mapper/util/MappingUtil.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - *

- * Licensed 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. +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.mapper.util; diff --git a/mapstruct-mapping-from-map/src/test/java/org/mapstruct/example/MapToBeanMapperTest.java b/mapstruct-mapping-from-map/src/test/java/org/mapstruct/example/MapToBeanMapperTest.java new file mode 100644 index 00000000..ff0b9f6c --- /dev/null +++ b/mapstruct-mapping-from-map/src/test/java/org/mapstruct/example/MapToBeanMapperTest.java @@ -0,0 +1,38 @@ +package org.mapstruct.example; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + +import java.util.HashMap; +import java.util.Map; + +import org.junit.Test; +import org.mapstruct.example.dto.Department; +import org.mapstruct.example.dto.Employee; +import org.mapstruct.example.mapper.MapToBeanMapper; + +/** + * @author Filip Hrisafov + */ +public class MapToBeanMapperTest { + + @Test + public void shouldMapMapToBean() { + Map map = new HashMap<>(); + map.put("id", "1234"); + map.put("name", "Tester"); + map.put("did", "4321"); //Department Id + map.put("dname", "Test");// Depart name + + Employee employee = MapToBeanMapper.INSTANCE.fromMap(map); + + assertNotNull(employee); + assertEquals(employee.getId(), "1234"); + assertEquals(employee.getName(), "Tester"); + + Department department = employee.getDepartment(); + assertNotNull(department); + assertEquals(department.getId(), "4321"); + assertEquals(department.getName(), "Test"); + } +} diff --git a/mapstruct-mapping-from-map/src/test/java/org/mapstruct/example/SourceTargetMapperTest.java b/mapstruct-mapping-from-map/src/test/java/org/mapstruct/example/SourceTargetMapperTest.java index b2ada78f..3739e89c 100644 --- a/mapstruct-mapping-from-map/src/test/java/org/mapstruct/example/SourceTargetMapperTest.java +++ b/mapstruct-mapping-from-map/src/test/java/org/mapstruct/example/SourceTargetMapperTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; diff --git a/mapstruct-mapping-with-cycles/pom.xml b/mapstruct-mapping-with-cycles/pom.xml index 080664a1..4ad1a32c 100644 --- a/mapstruct-mapping-with-cycles/pom.xml +++ b/mapstruct-mapping-with-cycles/pom.xml @@ -1,22 +1,9 @@ UTF-8 - 1.3.1.Final + 1.7.0.Beta1 @@ -51,14 +38,14 @@ junit junit - 4.12 + 4.13.1 test org.assertj assertj-core - 3.6.2 + 3.27.7 test @@ -69,7 +56,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.14.1 1.8 1.8 diff --git a/mapstruct-mapping-with-cycles/src/main/java/org/mapstruct/example/dto/Employee.java b/mapstruct-mapping-with-cycles/src/main/java/org/mapstruct/example/dto/Employee.java index 64fc4b76..fe169065 100644 --- a/mapstruct-mapping-with-cycles/src/main/java/org/mapstruct/example/dto/Employee.java +++ b/mapstruct-mapping-with-cycles/src/main/java/org/mapstruct/example/dto/Employee.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - *

- * Licensed 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. +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-mapping-with-cycles/src/main/java/org/mapstruct/example/dto/EmployeeDto.java b/mapstruct-mapping-with-cycles/src/main/java/org/mapstruct/example/dto/EmployeeDto.java index 5d5fd640..48cd939e 100644 --- a/mapstruct-mapping-with-cycles/src/main/java/org/mapstruct/example/dto/EmployeeDto.java +++ b/mapstruct-mapping-with-cycles/src/main/java/org/mapstruct/example/dto/EmployeeDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - *

- * Licensed 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. +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-mapping-with-cycles/src/main/java/org/mapstruct/example/mapper/CycleAvoidingMappingContext.java b/mapstruct-mapping-with-cycles/src/main/java/org/mapstruct/example/mapper/CycleAvoidingMappingContext.java index 26938604..ed82e178 100644 --- a/mapstruct-mapping-with-cycles/src/main/java/org/mapstruct/example/mapper/CycleAvoidingMappingContext.java +++ b/mapstruct-mapping-with-cycles/src/main/java/org/mapstruct/example/mapper/CycleAvoidingMappingContext.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.mapper; diff --git a/mapstruct-mapping-with-cycles/src/main/java/org/mapstruct/example/mapper/EmployeeMapper.java b/mapstruct-mapping-with-cycles/src/main/java/org/mapstruct/example/mapper/EmployeeMapper.java index 11fc87b0..a3155cd2 100644 --- a/mapstruct-mapping-with-cycles/src/main/java/org/mapstruct/example/mapper/EmployeeMapper.java +++ b/mapstruct-mapping-with-cycles/src/main/java/org/mapstruct/example/mapper/EmployeeMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - *

- * Licensed 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. +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.mapper; @@ -34,7 +21,7 @@ public interface EmployeeMapper { EmployeeMapper MAPPER = Mappers.getMapper( EmployeeMapper.class ); - @Mapping(source = "employeeName", target = "name") + @Mapping(target = "name", source = "employeeName") Employee toEmployee(EmployeeDto employeeDto, @Context CycleAvoidingMappingContext context); @InheritInverseConfiguration diff --git a/mapstruct-mapping-with-cycles/src/test/java/org/mapstruct/example/EmployeeMapperTest.java b/mapstruct-mapping-with-cycles/src/test/java/org/mapstruct/example/EmployeeMapperTest.java index b4a87e28..d2d1be81 100644 --- a/mapstruct-mapping-with-cycles/src/test/java/org/mapstruct/example/EmployeeMapperTest.java +++ b/mapstruct-mapping-with-cycles/src/test/java/org/mapstruct/example/EmployeeMapperTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; diff --git a/mapstruct-metadata-with-annotations/pom.xml b/mapstruct-metadata-with-annotations/pom.xml index 743cdb88..3b6309ba 100644 --- a/mapstruct-metadata-with-annotations/pom.xml +++ b/mapstruct-metadata-with-annotations/pom.xml @@ -1,22 +1,9 @@ @@ -27,7 +14,7 @@ UTF-8 - 1.3.1.Final + 1.7.0.Beta1 @@ -40,14 +27,14 @@ junit junit - 4.12 + 4.13.1 test org.assertj assertj-core - 3.9.0 + 3.27.7 test @@ -57,7 +44,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.14.1 1.8 1.8 diff --git a/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/dto/LegalEntity.java b/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/dto/LegalEntity.java index e2064e51..e179029a 100644 --- a/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/dto/LegalEntity.java +++ b/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/dto/LegalEntity.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2018 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.metadata.dto; diff --git a/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/dto/TaxRecord.java b/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/dto/TaxRecord.java index 6d3b0bd9..f2ded5e7 100644 --- a/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/dto/TaxRecord.java +++ b/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/dto/TaxRecord.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2018 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.metadata.dto; diff --git a/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/entities/LegalEntityPE.java b/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/entities/LegalEntityPE.java index a2da553d..79094d6a 100644 --- a/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/entities/LegalEntityPE.java +++ b/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/entities/LegalEntityPE.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2018 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.metadata.entities; diff --git a/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/entities/OrganisationPE.java b/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/entities/OrganisationPE.java index 92004a73..697d2ff2 100644 --- a/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/entities/OrganisationPE.java +++ b/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/entities/OrganisationPE.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2018 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.metadata.entities; diff --git a/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/entities/PersonPE.java b/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/entities/PersonPE.java index ff9040da..fe3e1bff 100644 --- a/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/entities/PersonPE.java +++ b/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/entities/PersonPE.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2018 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.metadata.entities; diff --git a/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/entities/TaxRecordPE.java b/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/entities/TaxRecordPE.java index d1ef7b76..ccb5a3a2 100644 --- a/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/entities/TaxRecordPE.java +++ b/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/entities/TaxRecordPE.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2018 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.metadata.entities; diff --git a/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/mapper/SourceTargetMapper.java b/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/mapper/SourceTargetMapper.java index ad10e8dd..8a933620 100644 --- a/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/mapper/SourceTargetMapper.java +++ b/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/mapper/SourceTargetMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2018 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.metadata.mapper; diff --git a/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/mapper/annotations/DoNotSelectForMapping.java b/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/mapper/annotations/DoNotSelectForMapping.java index acfebe42..e76f3649 100644 --- a/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/mapper/annotations/DoNotSelectForMapping.java +++ b/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/mapper/annotations/DoNotSelectForMapping.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2018 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.metadata.mapper.annotations; diff --git a/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/mapper/annotations/Treatment.java b/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/mapper/annotations/Treatment.java index 29d38fad..8457f14e 100644 --- a/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/mapper/annotations/Treatment.java +++ b/mapstruct-metadata-with-annotations/src/main/java/org/mapstruct/example/metadata/mapper/annotations/Treatment.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2018 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.metadata.mapper.annotations; diff --git a/mapstruct-metadata-with-annotations/src/test/java/org/mapstruct/example/SourceTargetMapperTest.java b/mapstruct-metadata-with-annotations/src/test/java/org/mapstruct/example/SourceTargetMapperTest.java index d18bea60..92b37e49 100644 --- a/mapstruct-metadata-with-annotations/src/test/java/org/mapstruct/example/SourceTargetMapperTest.java +++ b/mapstruct-metadata-with-annotations/src/test/java/org/mapstruct/example/SourceTargetMapperTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2018 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; diff --git a/mapstruct-nested-bean-mappings/pom.xml b/mapstruct-nested-bean-mappings/pom.xml index 271f0f2a..41976934 100644 --- a/mapstruct-nested-bean-mappings/pom.xml +++ b/mapstruct-nested-bean-mappings/pom.xml @@ -1,22 +1,9 @@ UTF-8 - 1.3.1.Final + 1.7.0.Beta1 @@ -51,14 +38,14 @@ junit junit - 4.12 + 4.13.1 test org.assertj assertj-core - 3.6.2 + 3.27.7 test @@ -69,7 +56,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.14.1 1.8 1.8 diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/FishDto.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/FishDto.java index 7df77354..0de9cd70 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/FishDto.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/FishDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/FishTankDto.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/FishTankDto.java index 02f60e74..627d5bfc 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/FishTankDto.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/FishTankDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/FishTankWithNestedDocumentDto.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/FishTankWithNestedDocumentDto.java index 093ded05..179412c2 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/FishTankWithNestedDocumentDto.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/FishTankWithNestedDocumentDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/MaterialDto.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/MaterialDto.java index cecc43c8..b000783b 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/MaterialDto.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/MaterialDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/MaterialTypeDto.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/MaterialTypeDto.java index 22d5f0a8..3f230210 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/MaterialTypeDto.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/MaterialTypeDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/OrnamentDto.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/OrnamentDto.java index 3e6d40fa..ad60ebeb 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/OrnamentDto.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/OrnamentDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterPlantDto.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterPlantDto.java index bbf06de8..0bec1fa5 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterPlantDto.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterPlantDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterQualityDto.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterQualityDto.java index 5012a573..e8d1f083 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterQualityDto.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterQualityDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterQualityOrganisationDto.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterQualityOrganisationDto.java index fba834a8..bbed7810 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterQualityOrganisationDto.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterQualityOrganisationDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterQualityReportDto.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterQualityReportDto.java index 4c8b9578..dbc0919b 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterQualityReportDto.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterQualityReportDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterQualityWithDocumentDto.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterQualityWithDocumentDto.java index c332bc1b..c96bb09a 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterQualityWithDocumentDto.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/dto/WaterQualityWithDocumentDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/mapper/FishTankMapper.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/mapper/FishTankMapper.java index c5d9f798..9321efd6 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/mapper/FishTankMapper.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/mapper/FishTankMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.mapper; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/mapper/FishTankMapperConstant.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/mapper/FishTankMapperConstant.java index f4f28754..5c98c3be 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/mapper/FishTankMapperConstant.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/mapper/FishTankMapperConstant.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.mapper; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/mapper/FishTankMapperExpression.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/mapper/FishTankMapperExpression.java index 17389c3a..3e56b73d 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/mapper/FishTankMapperExpression.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/mapper/FishTankMapperExpression.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.mapper; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/mapper/FishTankMapperWithDocument.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/mapper/FishTankMapperWithDocument.java index 0d19a0da..66ee5433 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/mapper/FishTankMapperWithDocument.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/mapper/FishTankMapperWithDocument.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.mapper; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/Fish.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/Fish.java index cc07c141..adeeca3c 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/Fish.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/Fish.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.model; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/FishTank.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/FishTank.java index eadda141..3e20e40f 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/FishTank.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/FishTank.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.model; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/Interior.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/Interior.java index 438b7a73..9b587753 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/Interior.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/Interior.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.model; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/MaterialType.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/MaterialType.java index 2ed3e035..24631bc0 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/MaterialType.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/MaterialType.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.model; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/Ornament.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/Ornament.java index 4e94c186..98a8ff09 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/Ornament.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/Ornament.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.model; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/WaterPlant.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/WaterPlant.java index e93f0db0..bd0bc995 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/WaterPlant.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/WaterPlant.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.model; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/WaterQuality.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/WaterQuality.java index 33577490..9d6c8191 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/WaterQuality.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/WaterQuality.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.model; diff --git a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/WaterQualityReport.java b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/WaterQualityReport.java index 4ced9766..31fb3378 100644 --- a/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/WaterQualityReport.java +++ b/mapstruct-nested-bean-mappings/src/main/java/org/mapstruct/example/model/WaterQualityReport.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.model; diff --git a/mapstruct-nested-bean-mappings/src/test/java/org/mapstruct/example/FishTanksMappersTest.java b/mapstruct-nested-bean-mappings/src/test/java/org/mapstruct/example/FishTanksMappersTest.java index 3ef79fc1..10abe98f 100644 --- a/mapstruct-nested-bean-mappings/src/test/java/org/mapstruct/example/FishTanksMappersTest.java +++ b/mapstruct-nested-bean-mappings/src/test/java/org/mapstruct/example/FishTanksMappersTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; diff --git a/mapstruct-on-ant/build.xml b/mapstruct-on-ant/build.xml index b8383e2c..0f2e8143 100644 --- a/mapstruct-on-ant/build.xml +++ b/mapstruct-on-ant/build.xml @@ -1,22 +1,12 @@ - + diff --git a/mapstruct-on-ant/src/main/java/org/mapstruct/example/Source.java b/mapstruct-on-ant/src/main/java/org/mapstruct/example/Source.java index daf483c2..234c6055 100644 --- a/mapstruct-on-ant/src/main/java/org/mapstruct/example/Source.java +++ b/mapstruct-on-ant/src/main/java/org/mapstruct/example/Source.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; diff --git a/mapstruct-on-ant/src/main/java/org/mapstruct/example/SourceTargetMapper.java b/mapstruct-on-ant/src/main/java/org/mapstruct/example/SourceTargetMapper.java index c0abe930..79ebd8c7 100644 --- a/mapstruct-on-ant/src/main/java/org/mapstruct/example/SourceTargetMapper.java +++ b/mapstruct-on-ant/src/main/java/org/mapstruct/example/SourceTargetMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; @@ -28,8 +15,8 @@ public interface SourceTargetMapper { SourceTargetMapper INSTANCE = Mappers.getMapper(SourceTargetMapper.class); - @Mapping(source = "qax", target = "baz") - @Mapping(source = "baz", target = "qax") + @Mapping(target = "baz", source = "qax") + @Mapping(target = "qax", source = "baz") Target sourceToTarget(Source source); @InheritInverseConfiguration diff --git a/mapstruct-on-ant/src/main/java/org/mapstruct/example/Target.java b/mapstruct-on-ant/src/main/java/org/mapstruct/example/Target.java index 8f704bab..74848972 100644 --- a/mapstruct-on-ant/src/main/java/org/mapstruct/example/Target.java +++ b/mapstruct-on-ant/src/main/java/org/mapstruct/example/Target.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; diff --git a/mapstruct-on-ant/src/test/java/org/mapstruct/example/ConversionTest.java b/mapstruct-on-ant/src/test/java/org/mapstruct/example/ConversionTest.java index 9261afd7..85e8c8be 100644 --- a/mapstruct-on-ant/src/test/java/org/mapstruct/example/ConversionTest.java +++ b/mapstruct-on-ant/src/test/java/org/mapstruct/example/ConversionTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; diff --git a/mapstruct-on-bazel/.bazelversion b/mapstruct-on-bazel/.bazelversion new file mode 100644 index 00000000..f9c71a52 --- /dev/null +++ b/mapstruct-on-bazel/.bazelversion @@ -0,0 +1 @@ +8.5.1 diff --git a/mapstruct-on-bazel/BUILD.bazel b/mapstruct-on-bazel/BUILD.bazel new file mode 100644 index 00000000..5df19289 --- /dev/null +++ b/mapstruct-on-bazel/BUILD.bazel @@ -0,0 +1,49 @@ +load("@rules_java//java:defs.bzl", "java_library", "java_plugin", "java_test") + +java_library( + name = "mapstruct-on-bazel", + srcs = glob(["src/main/java/**/*.java"]), + resources = glob(["src/main/resources/**"], allow_empty = True), + deps = [ + ":mapstruct", + ], +) + +java_library( + name = "tests", + srcs = glob(["src/test/java/**/*.java"]), + resources = glob(["src/test/resources/**"], allow_empty = True), + deps = [ + ":mapstruct-on-bazel", + "@maven//:junit_junit", + "@maven//:org_assertj_assertj_core", + ], +) + +java_test( + name = "ConversionTest", + test_class = "org.mapstruct.example.ConversionTest", + runtime_deps = [ + ":tests", + ], +) + +java_library( + name = "mapstruct", + exported_plugins = [ + ":mapstruct_plugin", + ], + visibility = ["//visibility:public"], + exports = [ + "@maven//:org_mapstruct_mapstruct", + ], +) + +java_plugin( + name = "mapstruct_plugin", + generates_api = True, + processor_class = "org.mapstruct.ap.MappingProcessor", + deps = [ + "@maven//:org_mapstruct_mapstruct_processor", + ], +) diff --git a/mapstruct-on-bazel/MODULE.bazel b/mapstruct-on-bazel/MODULE.bazel new file mode 100644 index 00000000..7923d979 --- /dev/null +++ b/mapstruct-on-bazel/MODULE.bazel @@ -0,0 +1,19 @@ +module( + name = "mapstruct-on-bazel", + version = "1.0.0", +) + +bazel_dep(name = "rules_java", version = "8.14.0") + +maven = use_extension("@rules_jvm_external//:extensions.bzl", "maven") +bazel_dep(name = "rules_jvm_external", version = "6.6") + +maven.install( + artifacts = [ + "org.mapstruct:mapstruct:1.7.0.Beta1", + "org.mapstruct:mapstruct-processor:1.7.0.Beta1", + "junit:junit:4.13.2", + "org.assertj:assertj-core:3.27.7", + ], +) +use_repo(maven, "maven") diff --git a/mapstruct-on-bazel/MODULE.bazel.lock b/mapstruct-on-bazel/MODULE.bazel.lock new file mode 100644 index 00000000..8fb08990 --- /dev/null +++ b/mapstruct-on-bazel/MODULE.bazel.lock @@ -0,0 +1,207 @@ +{ + "lockFileVersion": 24, + "registryFileHashes": { + "https://bcr.bazel.build/bazel_registry.json": "8a28e4aff06ee60aed2a8c281907fb8bcbf3b753c91fb5a5c57da3215d5b3497", + "https://bcr.bazel.build/modules/abseil-cpp/20210324.2/MODULE.bazel": "7cd0312e064fde87c8d1cd79ba06c876bd23630c83466e9500321be55c96ace2", + "https://bcr.bazel.build/modules/abseil-cpp/20211102.0/MODULE.bazel": "70390338f7a5106231d20620712f7cccb659cd0e9d073d1991c038eb9fc57589", + "https://bcr.bazel.build/modules/abseil-cpp/20230125.1/MODULE.bazel": "89047429cb0207707b2dface14ba7f8df85273d484c2572755be4bab7ce9c3a0", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.0.bcr.1/MODULE.bazel": "1c8cec495288dccd14fdae6e3f95f772c1c91857047a098fad772034264cc8cb", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.0/MODULE.bazel": "d253ae36a8bd9ee3c5955384096ccb6baf16a1b1e93e858370da0a3b94f77c16", + "https://bcr.bazel.build/modules/abseil-cpp/20230802.1/MODULE.bazel": "fa92e2eb41a04df73cdabeec37107316f7e5272650f81d6cc096418fe647b915", + "https://bcr.bazel.build/modules/abseil-cpp/20240116.1/MODULE.bazel": "37bcdb4440fbb61df6a1c296ae01b327f19e9bb521f9b8e26ec854b6f97309ed", + "https://bcr.bazel.build/modules/abseil-cpp/20240116.1/source.json": "9be551b8d4e3ef76875c0d744b5d6a504a27e3ae67bc6b28f46415fd2d2957da", + "https://bcr.bazel.build/modules/bazel_features/1.1.1/MODULE.bazel": "27b8c79ef57efe08efccbd9dd6ef70d61b4798320b8d3c134fd571f78963dbcd", + "https://bcr.bazel.build/modules/bazel_features/1.11.0/MODULE.bazel": "f9382337dd5a474c3b7d334c2f83e50b6eaedc284253334cf823044a26de03e8", + "https://bcr.bazel.build/modules/bazel_features/1.15.0/MODULE.bazel": "d38ff6e517149dc509406aca0db3ad1efdd890a85e049585b7234d04238e2a4d", + "https://bcr.bazel.build/modules/bazel_features/1.17.0/MODULE.bazel": "039de32d21b816b47bd42c778e0454217e9c9caac4a3cf8e15c7231ee3ddee4d", + "https://bcr.bazel.build/modules/bazel_features/1.18.0/MODULE.bazel": "1be0ae2557ab3a72a57aeb31b29be347bcdc5d2b1eb1e70f39e3851a7e97041a", + "https://bcr.bazel.build/modules/bazel_features/1.19.0/MODULE.bazel": "59adcdf28230d220f0067b1f435b8537dd033bfff8db21335ef9217919c7fb58", + "https://bcr.bazel.build/modules/bazel_features/1.30.0/MODULE.bazel": "a14b62d05969a293b80257e72e597c2da7f717e1e69fa8b339703ed6731bec87", + "https://bcr.bazel.build/modules/bazel_features/1.30.0/source.json": "b07e17f067fe4f69f90b03b36ef1e08fe0d1f3cac254c1241a1818773e3423bc", + "https://bcr.bazel.build/modules/bazel_features/1.4.1/MODULE.bazel": "e45b6bb2350aff3e442ae1111c555e27eac1d915e77775f6fdc4b351b758b5d7", + "https://bcr.bazel.build/modules/bazel_features/1.9.1/MODULE.bazel": "8f679097876a9b609ad1f60249c49d68bfab783dd9be012faf9d82547b14815a", + "https://bcr.bazel.build/modules/bazel_skylib/1.0.3/MODULE.bazel": "bcb0fd896384802d1ad283b4e4eb4d718eebd8cb820b0a2c3a347fb971afd9d8", + "https://bcr.bazel.build/modules/bazel_skylib/1.1.1/MODULE.bazel": "1add3e7d93ff2e6998f9e118022c84d163917d912f5afafb3058e3d2f1545b5e", + "https://bcr.bazel.build/modules/bazel_skylib/1.2.0/MODULE.bazel": "44fe84260e454ed94ad326352a698422dbe372b21a1ac9f3eab76eb531223686", + "https://bcr.bazel.build/modules/bazel_skylib/1.2.1/MODULE.bazel": "f35baf9da0efe45fa3da1696ae906eea3d615ad41e2e3def4aeb4e8bc0ef9a7a", + "https://bcr.bazel.build/modules/bazel_skylib/1.3.0/MODULE.bazel": "20228b92868bf5cfc41bda7afc8a8ba2a543201851de39d990ec957b513579c5", + "https://bcr.bazel.build/modules/bazel_skylib/1.4.1/MODULE.bazel": "a0dcb779424be33100dcae821e9e27e4f2901d9dfd5333efe5ac6a8d7ab75e1d", + "https://bcr.bazel.build/modules/bazel_skylib/1.4.2/MODULE.bazel": "3bd40978e7a1fac911d5989e6b09d8f64921865a45822d8b09e815eaa726a651", + "https://bcr.bazel.build/modules/bazel_skylib/1.5.0/MODULE.bazel": "32880f5e2945ce6a03d1fbd588e9198c0a959bb42297b2cfaf1685b7bc32e138", + "https://bcr.bazel.build/modules/bazel_skylib/1.6.1/MODULE.bazel": "8fdee2dbaace6c252131c00e1de4b165dc65af02ea278476187765e1a617b917", + "https://bcr.bazel.build/modules/bazel_skylib/1.7.0/MODULE.bazel": "0db596f4563de7938de764cc8deeabec291f55e8ec15299718b93c4423e9796d", + "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/MODULE.bazel": "3120d80c5861aa616222ec015332e5f8d3171e062e3e804a2a0253e1be26e59b", + "https://bcr.bazel.build/modules/bazel_skylib/1.7.1/source.json": "f121b43eeefc7c29efbd51b83d08631e2347297c95aac9764a701f2a6a2bb953", + "https://bcr.bazel.build/modules/buildozer/7.1.2/MODULE.bazel": "2e8dd40ede9c454042645fd8d8d0cd1527966aa5c919de86661e62953cd73d84", + "https://bcr.bazel.build/modules/buildozer/7.1.2/source.json": "c9028a501d2db85793a6996205c8de120944f50a0d570438fcae0457a5f9d1f8", + "https://bcr.bazel.build/modules/google_benchmark/1.8.2/MODULE.bazel": "a70cf1bba851000ba93b58ae2f6d76490a9feb74192e57ab8e8ff13c34ec50cb", + "https://bcr.bazel.build/modules/googletest/1.11.0/MODULE.bazel": "3a83f095183f66345ca86aa13c58b59f9f94a2f81999c093d4eeaa2d262d12f4", + "https://bcr.bazel.build/modules/googletest/1.14.0.bcr.1/MODULE.bazel": "22c31a561553727960057361aa33bf20fb2e98584bc4fec007906e27053f80c6", + "https://bcr.bazel.build/modules/googletest/1.14.0.bcr.1/source.json": "41e9e129f80d8c8bf103a7acc337b76e54fad1214ac0a7084bf24f4cd924b8b4", + "https://bcr.bazel.build/modules/googletest/1.14.0/MODULE.bazel": "cfbcbf3e6eac06ef9d85900f64424708cc08687d1b527f0ef65aa7517af8118f", + "https://bcr.bazel.build/modules/jsoncpp/1.9.5/MODULE.bazel": "31271aedc59e815656f5736f282bb7509a97c7ecb43e927ac1a37966e0578075", + "https://bcr.bazel.build/modules/jsoncpp/1.9.5/source.json": "4108ee5085dd2885a341c7fab149429db457b3169b86eb081fa245eadf69169d", + "https://bcr.bazel.build/modules/libpfm/4.11.0/MODULE.bazel": "45061ff025b301940f1e30d2c16bea596c25b176c8b6b3087e92615adbd52902", + "https://bcr.bazel.build/modules/platforms/0.0.10/MODULE.bazel": "8cb8efaf200bdeb2150d93e162c40f388529a25852b332cec879373771e48ed5", + "https://bcr.bazel.build/modules/platforms/0.0.11/MODULE.bazel": "0daefc49732e227caa8bfa834d65dc52e8cc18a2faf80df25e8caea151a9413f", + "https://bcr.bazel.build/modules/platforms/0.0.11/source.json": "f7e188b79ebedebfe75e9e1d098b8845226c7992b307e28e1496f23112e8fc29", + "https://bcr.bazel.build/modules/platforms/0.0.4/MODULE.bazel": "9b328e31ee156f53f3c416a64f8491f7eb731742655a47c9eec4703a71644aee", + "https://bcr.bazel.build/modules/platforms/0.0.5/MODULE.bazel": "5733b54ea419d5eaf7997054bb55f6a1d0b5ff8aedf0176fef9eea44f3acda37", + "https://bcr.bazel.build/modules/platforms/0.0.6/MODULE.bazel": "ad6eeef431dc52aefd2d77ed20a4b353f8ebf0f4ecdd26a807d2da5aa8cd0615", + "https://bcr.bazel.build/modules/platforms/0.0.7/MODULE.bazel": "72fd4a0ede9ee5c021f6a8dd92b503e089f46c227ba2813ff183b71616034814", + "https://bcr.bazel.build/modules/platforms/0.0.8/MODULE.bazel": "9f142c03e348f6d263719f5074b21ef3adf0b139ee4c5133e2aa35664da9eb2d", + "https://bcr.bazel.build/modules/protobuf/21.7/MODULE.bazel": "a5a29bb89544f9b97edce05642fac225a808b5b7be74038ea3640fae2f8e66a7", + "https://bcr.bazel.build/modules/protobuf/27.0/MODULE.bazel": "7873b60be88844a0a1d8f80b9d5d20cfbd8495a689b8763e76c6372998d3f64c", + "https://bcr.bazel.build/modules/protobuf/27.1/MODULE.bazel": "703a7b614728bb06647f965264967a8ef1c39e09e8f167b3ca0bb1fd80449c0d", + "https://bcr.bazel.build/modules/protobuf/29.0-rc2/MODULE.bazel": "6241d35983510143049943fc0d57937937122baf1b287862f9dc8590fc4c37df", + "https://bcr.bazel.build/modules/protobuf/29.0/MODULE.bazel": "319dc8bf4c679ff87e71b1ccfb5a6e90a6dbc4693501d471f48662ac46d04e4e", + "https://bcr.bazel.build/modules/protobuf/29.0/source.json": "b857f93c796750eef95f0d61ee378f3420d00ee1dd38627b27193aa482f4f981", + "https://bcr.bazel.build/modules/protobuf/3.19.0/MODULE.bazel": "6b5fbb433f760a99a22b18b6850ed5784ef0e9928a72668b66e4d7ccd47db9b0", + "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/MODULE.bazel": "88af1c246226d87e65be78ed49ecd1e6f5e98648558c14ce99176da041dc378e", + "https://bcr.bazel.build/modules/pybind11_bazel/2.11.1/source.json": "be4789e951dd5301282729fe3d4938995dc4c1a81c2ff150afc9f1b0504c6022", + "https://bcr.bazel.build/modules/re2/2023-09-01/MODULE.bazel": "cb3d511531b16cfc78a225a9e2136007a48cf8a677e4264baeab57fe78a80206", + "https://bcr.bazel.build/modules/re2/2023-09-01/source.json": "e044ce89c2883cd957a2969a43e79f7752f9656f6b20050b62f90ede21ec6eb4", + "https://bcr.bazel.build/modules/rules_android/0.1.1/MODULE.bazel": "48809ab0091b07ad0182defb787c4c5328bd3a278938415c00a7b69b50c4d3a8", + "https://bcr.bazel.build/modules/rules_android/0.1.1/source.json": "e6986b41626ee10bdc864937ffb6d6bf275bb5b9c65120e6137d56e6331f089e", + "https://bcr.bazel.build/modules/rules_cc/0.0.1/MODULE.bazel": "cb2aa0747f84c6c3a78dad4e2049c154f08ab9d166b1273835a8174940365647", + "https://bcr.bazel.build/modules/rules_cc/0.0.10/MODULE.bazel": "ec1705118f7eaedd6e118508d3d26deba2a4e76476ada7e0e3965211be012002", + "https://bcr.bazel.build/modules/rules_cc/0.0.13/MODULE.bazel": "0e8529ed7b323dad0775ff924d2ae5af7640b23553dfcd4d34344c7e7a867191", + "https://bcr.bazel.build/modules/rules_cc/0.0.14/MODULE.bazel": "5e343a3aac88b8d7af3b1b6d2093b55c347b8eefc2e7d1442f7a02dc8fea48ac", + "https://bcr.bazel.build/modules/rules_cc/0.0.15/MODULE.bazel": "6704c35f7b4a72502ee81f61bf88706b54f06b3cbe5558ac17e2e14666cd5dcc", + "https://bcr.bazel.build/modules/rules_cc/0.0.16/MODULE.bazel": "7661303b8fc1b4d7f532e54e9d6565771fea666fbdf839e0a86affcd02defe87", + "https://bcr.bazel.build/modules/rules_cc/0.0.2/MODULE.bazel": "6915987c90970493ab97393024c156ea8fb9f3bea953b2f3ec05c34f19b5695c", + "https://bcr.bazel.build/modules/rules_cc/0.0.6/MODULE.bazel": "abf360251023dfe3efcef65ab9d56beefa8394d4176dd29529750e1c57eaa33f", + "https://bcr.bazel.build/modules/rules_cc/0.0.8/MODULE.bazel": "964c85c82cfeb6f3855e6a07054fdb159aced38e99a5eecf7bce9d53990afa3e", + "https://bcr.bazel.build/modules/rules_cc/0.0.9/MODULE.bazel": "836e76439f354b89afe6a911a7adf59a6b2518fafb174483ad78a2a2fde7b1c5", + "https://bcr.bazel.build/modules/rules_cc/0.1.1/MODULE.bazel": "2f0222a6f229f0bf44cd711dc13c858dad98c62d52bd51d8fc3a764a83125513", + "https://bcr.bazel.build/modules/rules_cc/0.1.1/source.json": "d61627377bd7dd1da4652063e368d9366fc9a73920bfa396798ad92172cf645c", + "https://bcr.bazel.build/modules/rules_foreign_cc/0.9.0/MODULE.bazel": "c9e8c682bf75b0e7c704166d79b599f93b72cfca5ad7477df596947891feeef6", + "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/MODULE.bazel": "40c97d1144356f52905566c55811f13b299453a14ac7769dfba2ac38192337a8", + "https://bcr.bazel.build/modules/rules_fuzzing/0.5.2/source.json": "c8b1e2c717646f1702290959a3302a178fb639d987ab61d548105019f11e527e", + "https://bcr.bazel.build/modules/rules_java/4.0.0/MODULE.bazel": "5a78a7ae82cd1a33cef56dc578c7d2a46ed0dca12643ee45edbb8417899e6f74", + "https://bcr.bazel.build/modules/rules_java/5.3.5/MODULE.bazel": "a4ec4f2db570171e3e5eb753276ee4b389bae16b96207e9d3230895c99644b86", + "https://bcr.bazel.build/modules/rules_java/6.0.0/MODULE.bazel": "8a43b7df601a7ec1af61d79345c17b31ea1fedc6711fd4abfd013ea612978e39", + "https://bcr.bazel.build/modules/rules_java/6.4.0/MODULE.bazel": "e986a9fe25aeaa84ac17ca093ef13a4637f6107375f64667a15999f77db6c8f6", + "https://bcr.bazel.build/modules/rules_java/6.5.2/MODULE.bazel": "1d440d262d0e08453fa0c4d8f699ba81609ed0e9a9a0f02cd10b3e7942e61e31", + "https://bcr.bazel.build/modules/rules_java/7.10.0/MODULE.bazel": "530c3beb3067e870561739f1144329a21c851ff771cd752a49e06e3dc9c2e71a", + "https://bcr.bazel.build/modules/rules_java/7.12.2/MODULE.bazel": "579c505165ee757a4280ef83cda0150eea193eed3bef50b1004ba88b99da6de6", + "https://bcr.bazel.build/modules/rules_java/7.2.0/MODULE.bazel": "06c0334c9be61e6cef2c8c84a7800cef502063269a5af25ceb100b192453d4ab", + "https://bcr.bazel.build/modules/rules_java/7.3.2/MODULE.bazel": "50dece891cfdf1741ea230d001aa9c14398062f2b7c066470accace78e412bc2", + "https://bcr.bazel.build/modules/rules_java/7.6.1/MODULE.bazel": "2f14b7e8a1aa2f67ae92bc69d1ec0fa8d9f827c4e17ff5e5f02e91caa3b2d0fe", + "https://bcr.bazel.build/modules/rules_java/8.14.0/MODULE.bazel": "717717ed40cc69994596a45aec6ea78135ea434b8402fb91b009b9151dd65615", + "https://bcr.bazel.build/modules/rules_java/8.14.0/source.json": "8a88c4ca9e8759da53cddc88123880565c520503321e2566b4e33d0287a3d4bc", + "https://bcr.bazel.build/modules/rules_jvm_external/4.4.2/MODULE.bazel": "a56b85e418c83eb1839819f0b515c431010160383306d13ec21959ac412d2fe7", + "https://bcr.bazel.build/modules/rules_jvm_external/5.1/MODULE.bazel": "33f6f999e03183f7d088c9be518a63467dfd0be94a11d0055fe2d210f89aa909", + "https://bcr.bazel.build/modules/rules_jvm_external/5.2/MODULE.bazel": "d9351ba35217ad0de03816ef3ed63f89d411349353077348a45348b096615036", + "https://bcr.bazel.build/modules/rules_jvm_external/5.3/MODULE.bazel": "bf93870767689637164657731849fb887ad086739bd5d360d90007a581d5527d", + "https://bcr.bazel.build/modules/rules_jvm_external/6.1/MODULE.bazel": "75b5fec090dbd46cf9b7d8ea08cf84a0472d92ba3585b476f44c326eda8059c4", + "https://bcr.bazel.build/modules/rules_jvm_external/6.3/MODULE.bazel": "c998e060b85f71e00de5ec552019347c8bca255062c990ac02d051bb80a38df0", + "https://bcr.bazel.build/modules/rules_jvm_external/6.6/MODULE.bazel": "153042249c7060536dc95b6bb9f9bb8063b8a0b0cb7acdb381bddbc2374aed55", + "https://bcr.bazel.build/modules/rules_jvm_external/6.6/source.json": "b1d7ffc3877e5a76e6e48e6bce459cbb1712c90eba14861b112bd299587a534d", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.0/MODULE.bazel": "ef85697305025e5a61f395d4eaede272a5393cee479ace6686dba707de804d59", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/MODULE.bazel": "d269a01a18ee74d0335450b10f62c9ed81f2321d7958a2934e44272fe82dcef3", + "https://bcr.bazel.build/modules/rules_kotlin/1.9.6/source.json": "2faa4794364282db7c06600b7e5e34867a564ae91bda7cae7c29c64e9466b7d5", + "https://bcr.bazel.build/modules/rules_license/0.0.3/MODULE.bazel": "627e9ab0247f7d1e05736b59dbb1b6871373de5ad31c3011880b4133cafd4bd0", + "https://bcr.bazel.build/modules/rules_license/0.0.7/MODULE.bazel": "088fbeb0b6a419005b89cf93fe62d9517c0a2b8bb56af3244af65ecfe37e7d5d", + "https://bcr.bazel.build/modules/rules_license/1.0.0/MODULE.bazel": "a7fda60eefdf3d8c827262ba499957e4df06f659330bbe6cdbdb975b768bb65c", + "https://bcr.bazel.build/modules/rules_license/1.0.0/source.json": "a52c89e54cc311196e478f8382df91c15f7a2bfdf4c6cd0e2675cc2ff0b56efb", + "https://bcr.bazel.build/modules/rules_pkg/0.7.0/MODULE.bazel": "df99f03fc7934a4737122518bb87e667e62d780b610910f0447665a7e2be62dc", + "https://bcr.bazel.build/modules/rules_pkg/1.0.1/MODULE.bazel": "5b1df97dbc29623bccdf2b0dcd0f5cb08e2f2c9050aab1092fd39a41e82686ff", + "https://bcr.bazel.build/modules/rules_pkg/1.0.1/source.json": "bd82e5d7b9ce2d31e380dd9f50c111d678c3bdaca190cb76b0e1c71b05e1ba8a", + "https://bcr.bazel.build/modules/rules_proto/4.0.0/MODULE.bazel": "a7a7b6ce9bee418c1a760b3d84f83a299ad6952f9903c67f19e4edd964894e06", + "https://bcr.bazel.build/modules/rules_proto/5.3.0-21.7/MODULE.bazel": "e8dff86b0971688790ae75528fe1813f71809b5afd57facb44dad9e8eca631b7", + "https://bcr.bazel.build/modules/rules_proto/6.0.2/MODULE.bazel": "ce916b775a62b90b61888052a416ccdda405212b6aaeb39522f7dc53431a5e73", + "https://bcr.bazel.build/modules/rules_proto/7.0.2/MODULE.bazel": "bf81793bd6d2ad89a37a40693e56c61b0ee30f7a7fdbaf3eabbf5f39de47dea2", + "https://bcr.bazel.build/modules/rules_proto/7.0.2/source.json": "1e5e7260ae32ef4f2b52fd1d0de8d03b606a44c91b694d2f1afb1d3b28a48ce1", + "https://bcr.bazel.build/modules/rules_python/0.10.2/MODULE.bazel": "cc82bc96f2997baa545ab3ce73f196d040ffb8756fd2d66125a530031cd90e5f", + "https://bcr.bazel.build/modules/rules_python/0.23.1/MODULE.bazel": "49ffccf0511cb8414de28321f5fcf2a31312b47c40cc21577144b7447f2bf300", + "https://bcr.bazel.build/modules/rules_python/0.25.0/MODULE.bazel": "72f1506841c920a1afec76975b35312410eea3aa7b63267436bfb1dd91d2d382", + "https://bcr.bazel.build/modules/rules_python/0.28.0/MODULE.bazel": "cba2573d870babc976664a912539b320cbaa7114cd3e8f053c720171cde331ed", + "https://bcr.bazel.build/modules/rules_python/0.31.0/MODULE.bazel": "93a43dc47ee570e6ec9f5779b2e64c1476a6ce921c48cc9a1678a91dd5f8fd58", + "https://bcr.bazel.build/modules/rules_python/0.4.0/MODULE.bazel": "9208ee05fd48bf09ac60ed269791cf17fb343db56c8226a720fbb1cdf467166c", + "https://bcr.bazel.build/modules/rules_python/0.40.0/MODULE.bazel": "9d1a3cd88ed7d8e39583d9ffe56ae8a244f67783ae89b60caafc9f5cf318ada7", + "https://bcr.bazel.build/modules/rules_python/0.40.0/source.json": "939d4bd2e3110f27bfb360292986bb79fd8dcefb874358ccd6cdaa7bda029320", + "https://bcr.bazel.build/modules/rules_shell/0.2.0/MODULE.bazel": "fda8a652ab3c7d8fee214de05e7a9916d8b28082234e8d2c0094505c5268ed3c", + "https://bcr.bazel.build/modules/rules_shell/0.3.0/MODULE.bazel": "de4402cd12f4cc8fda2354fce179fdb068c0b9ca1ec2d2b17b3e21b24c1a937b", + "https://bcr.bazel.build/modules/rules_shell/0.3.0/source.json": "c55ed591aa5009401ddf80ded9762ac32c358d2517ee7820be981e2de9756cf3", + "https://bcr.bazel.build/modules/stardoc/0.5.1/MODULE.bazel": "1a05d92974d0c122f5ccf09291442580317cdd859f07a8655f1db9a60374f9f8", + "https://bcr.bazel.build/modules/stardoc/0.5.3/MODULE.bazel": "c7f6948dae6999bf0db32c1858ae345f112cacf98f174c7a8bb707e41b974f1c", + "https://bcr.bazel.build/modules/stardoc/0.5.6/MODULE.bazel": "c43dabc564990eeab55e25ed61c07a1aadafe9ece96a4efabb3f8bf9063b71ef", + "https://bcr.bazel.build/modules/stardoc/0.7.0/MODULE.bazel": "05e3d6d30c099b6770e97da986c53bd31844d7f13d41412480ea265ac9e8079c", + "https://bcr.bazel.build/modules/stardoc/0.7.1/MODULE.bazel": "3548faea4ee5dda5580f9af150e79d0f6aea934fc60c1cc50f4efdd9420759e7", + "https://bcr.bazel.build/modules/stardoc/0.7.1/source.json": "b6500ffcd7b48cd72c29bb67bcac781e12701cc0d6d55d266a652583cfcdab01", + "https://bcr.bazel.build/modules/upb/0.0.0-20220923-a547704/MODULE.bazel": "7298990c00040a0e2f121f6c32544bab27d4452f80d9ce51349b1a28f3005c43", + "https://bcr.bazel.build/modules/zlib/1.2.11/MODULE.bazel": "07b389abc85fdbca459b69e2ec656ae5622873af3f845e1c9d80fe179f3effa0", + "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.5/MODULE.bazel": "eec517b5bbe5492629466e11dae908d043364302283de25581e3eb944326c4ca", + "https://bcr.bazel.build/modules/zlib/1.3.1.bcr.5/source.json": "22bc55c47af97246cfc093d0acf683a7869377de362b5d1c552c2c2e16b7a806", + "https://bcr.bazel.build/modules/zlib/1.3.1/MODULE.bazel": "751c9940dcfe869f5f7274e1295422a34623555916eb98c174c1e945594bf198" + }, + "selectedYankedVersions": {}, + "moduleExtensions": { + "@@rules_kotlin+//src/main/starlark/core/repositories:bzlmod_setup.bzl%rules_kotlin_extensions": { + "general": { + "bzlTransitiveDigest": "rL/34P1aFDq2GqVC2zCFgQ8nTuOC6ziogocpvG50Qz8=", + "usagesDigest": "QI2z8ZUR+mqtbwsf2fLqYdJAkPOHdOV+tF2yVAUgRzw=", + "recordedFileInputs": {}, + "recordedDirentsInputs": {}, + "envVariables": {}, + "generatedRepoSpecs": { + "com_github_jetbrains_kotlin_git": { + "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:compiler.bzl%kotlin_compiler_git_repository", + "attributes": { + "urls": [ + "https://github.com/JetBrains/kotlin/releases/download/v1.9.23/kotlin-compiler-1.9.23.zip" + ], + "sha256": "93137d3aab9afa9b27cb06a824c2324195c6b6f6179d8a8653f440f5bd58be88" + } + }, + "com_github_jetbrains_kotlin": { + "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:compiler.bzl%kotlin_capabilities_repository", + "attributes": { + "git_repository_name": "com_github_jetbrains_kotlin_git", + "compiler_version": "1.9.23" + } + }, + "com_github_google_ksp": { + "repoRuleId": "@@rules_kotlin+//src/main/starlark/core/repositories:ksp.bzl%ksp_compiler_plugin_repository", + "attributes": { + "urls": [ + "https://github.com/google/ksp/releases/download/1.9.23-1.0.20/artifacts.zip" + ], + "sha256": "ee0618755913ef7fd6511288a232e8fad24838b9af6ea73972a76e81053c8c2d", + "strip_version": "1.9.23-1.0.20" + } + }, + "com_github_pinterest_ktlint": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_file", + "attributes": { + "sha256": "01b2e0ef893383a50dbeb13970fe7fa3be36ca3e83259e01649945b09d736985", + "urls": [ + "https://github.com/pinterest/ktlint/releases/download/1.3.0/ktlint" + ], + "executable": true + } + }, + "rules_android": { + "repoRuleId": "@@bazel_tools//tools/build_defs/repo:http.bzl%http_archive", + "attributes": { + "sha256": "cd06d15dd8bb59926e4d65f9003bfc20f9da4b2519985c27e190cddc8b7a7806", + "strip_prefix": "rules_android-0.1.1", + "urls": [ + "https://github.com/bazelbuild/rules_android/archive/v0.1.1.zip" + ] + } + } + }, + "recordedRepoMappingEntries": [ + [ + "rules_kotlin+", + "bazel_tools", + "bazel_tools" + ] + ] + } + } + }, + "facts": {} +} diff --git a/mapstruct-on-bazel/README.md b/mapstruct-on-bazel/README.md new file mode 100644 index 00000000..c4d5fb1e --- /dev/null +++ b/mapstruct-on-bazel/README.md @@ -0,0 +1,8 @@ +# Using MapStruct with Bazel + +This example project shows how to use MapStruct with Bazel. +The sample code is using the one from `mapstruct-on-ant`. + +To build the project, run `bazel build //...` or `bazel build //mapstruct-on-bazel:all` + +To test the project, run `bazel test //...` or `bazel test //mapstruct-on-bazel:ConversionTest` diff --git a/mapstruct-on-bazel/src/main/java/org/mapstruct/example/Source.java b/mapstruct-on-bazel/src/main/java/org/mapstruct/example/Source.java new file mode 100644 index 00000000..234c6055 --- /dev/null +++ b/mapstruct-on-bazel/src/main/java/org/mapstruct/example/Source.java @@ -0,0 +1,55 @@ +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 + */ +package org.mapstruct.example; + +public class Source { + + private int foo; + private Long bar; + private int qax; + private Long baz; + private int zip; + + public int getFoo() { + return foo; + } + + public void setFoo(int foo) { + this.foo = foo; + } + + public Long getBar() { + return bar; + } + + public void setBar(Long bar) { + this.bar = bar; + } + + public int getQax() { + return qax; + } + + public void setQax(int qax) { + this.qax = qax; + } + + public Long getBaz() { + return baz; + } + + public void setBaz(Long baz) { + this.baz = baz; + } + + public int getZip() { + return zip; + } + + public void setZip(int zip) { + this.zip = zip; + } +} diff --git a/mapstruct-on-bazel/src/main/java/org/mapstruct/example/SourceTargetMapper.java b/mapstruct-on-bazel/src/main/java/org/mapstruct/example/SourceTargetMapper.java new file mode 100644 index 00000000..79ebd8c7 --- /dev/null +++ b/mapstruct-on-bazel/src/main/java/org/mapstruct/example/SourceTargetMapper.java @@ -0,0 +1,24 @@ +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 + */ +package org.mapstruct.example; + +import org.mapstruct.InheritInverseConfiguration; +import org.mapstruct.Mapper; +import org.mapstruct.Mapping; +import org.mapstruct.factory.Mappers; + +@Mapper +public interface SourceTargetMapper { + + SourceTargetMapper INSTANCE = Mappers.getMapper(SourceTargetMapper.class); + + @Mapping(target = "baz", source = "qax") + @Mapping(target = "qax", source = "baz") + Target sourceToTarget(Source source); + + @InheritInverseConfiguration + Source targetToSource(Target target); +} diff --git a/mapstruct-on-bazel/src/main/java/org/mapstruct/example/Target.java b/mapstruct-on-bazel/src/main/java/org/mapstruct/example/Target.java new file mode 100644 index 00000000..74848972 --- /dev/null +++ b/mapstruct-on-bazel/src/main/java/org/mapstruct/example/Target.java @@ -0,0 +1,55 @@ +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 + */ +package org.mapstruct.example; + +public class Target { + + private Long foo; + private int bar; + private Long baz; + private int qax; + private String zip; + + public Long getFoo() { + return foo; + } + + public void setFoo(Long foo) { + this.foo = foo; + } + + public int getBar() { + return bar; + } + + public void setBar(int bar) { + this.bar = bar; + } + + public Long getBaz() { + return baz; + } + + public void setBaz(Long baz) { + this.baz = baz; + } + + public int getQax() { + return qax; + } + + public void setQax(int qax) { + this.qax = qax; + } + + public String getZip() { + return zip; + } + + public void setZip(String zip) { + this.zip = zip; + } +} diff --git a/mapstruct-on-bazel/src/test/java/org/mapstruct/example/ConversionTest.java b/mapstruct-on-bazel/src/test/java/org/mapstruct/example/ConversionTest.java new file mode 100644 index 00000000..44cbfe88 --- /dev/null +++ b/mapstruct-on-bazel/src/test/java/org/mapstruct/example/ConversionTest.java @@ -0,0 +1,80 @@ +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 + */ +package org.mapstruct.example; + +import org.junit.Test; + +import static org.assertj.core.api.Assertions.assertThat; + +public class ConversionTest { + + @Test + public void shouldApplyConversions() { + Source source = new Source(); + source.setFoo(42); + source.setBar(23L); + source.setZip(73); + + Target target = SourceTargetMapper.INSTANCE.sourceToTarget(source); + + assertThat(target).isNotNull(); + assertThat(target.getFoo()).isEqualTo(42L); + assertThat(target.getBar()).isEqualTo(23); + assertThat(target.getZip()).isEqualTo("73"); + } + + @Test + public void shouldHandleNulls() { + Source source = new Source(); + Target target = SourceTargetMapper.INSTANCE.sourceToTarget(source); + + assertThat(target).isNotNull(); + assertThat(target.getFoo()).isEqualTo(0L); + assertThat(target.getBar()).isEqualTo(0); + assertThat(target.getZip()).isEqualTo("0"); + } + + @Test + public void shouldApplyConversionsToMappedProperties() { + Source source = new Source(); + source.setQax(42); + source.setBaz(23L); + + Target target = SourceTargetMapper.INSTANCE.sourceToTarget(source); + + assertThat(target).isNotNull(); + assertThat(target.getBaz()).isEqualTo(42L); + assertThat(target.getQax()).isEqualTo(23); + } + + @Test + public void shouldApplyConversionsForReverseMapping() { + Target target = new Target(); + target.setFoo(42L); + target.setBar(23); + target.setZip("73"); + + Source source = SourceTargetMapper.INSTANCE.targetToSource(target); + + assertThat(source).isNotNull(); + assertThat(source.getFoo()).isEqualTo(42); + assertThat(source.getBar()).isEqualTo(23); + assertThat(source.getZip()).isEqualTo(73); + } + + @Test + public void shouldApplyConversionsToMappedPropertiesForReverseMapping() { + Target target = new Target(); + target.setQax(42); + target.setBaz(23L); + + Source source = SourceTargetMapper.INSTANCE.targetToSource(target); + + assertThat(source).isNotNull(); + assertThat(source.getBaz()).isEqualTo(42); + assertThat(source.getQax()).isEqualTo(23); + } +} diff --git a/mapstruct-on-gradle-protobuf3/build.gradle b/mapstruct-on-gradle-protobuf3/build.gradle index 24373571..faf1be79 100644 --- a/mapstruct-on-gradle-protobuf3/build.gradle +++ b/mapstruct-on-gradle-protobuf3/build.gradle @@ -1,6 +1,6 @@ plugins { id 'java' - id "com.google.protobuf" version "0.8.8" + id "com.google.protobuf" version "0.9.4" } subprojects { @@ -9,6 +9,6 @@ subprojects { } ext { - mapstructVersion = "1.3.0.Beta2" + mapstructVersion = "1.7.0.Beta1" } } diff --git a/mapstruct-on-gradle-protobuf3/gradle/wrapper/gradle-wrapper.jar b/mapstruct-on-gradle-protobuf3/gradle/wrapper/gradle-wrapper.jar index f3d88b1c..e708b1c0 100644 Binary files a/mapstruct-on-gradle-protobuf3/gradle/wrapper/gradle-wrapper.jar and b/mapstruct-on-gradle-protobuf3/gradle/wrapper/gradle-wrapper.jar differ diff --git a/mapstruct-on-gradle-protobuf3/gradle/wrapper/gradle-wrapper.properties b/mapstruct-on-gradle-protobuf3/gradle/wrapper/gradle-wrapper.properties index b7c8c5db..db9a6b82 100644 --- a/mapstruct-on-gradle-protobuf3/gradle/wrapper/gradle-wrapper.properties +++ b/mapstruct-on-gradle-protobuf3/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/mapstruct-on-gradle-protobuf3/gradlew b/mapstruct-on-gradle-protobuf3/gradlew index 2fe81a7d..4f906e0c 100755 --- a/mapstruct-on-gradle-protobuf3/gradlew +++ b/mapstruct-on-gradle-protobuf3/gradlew @@ -82,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -129,6 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath diff --git a/mapstruct-on-gradle-protobuf3/gradlew.bat b/mapstruct-on-gradle-protobuf3/gradlew.bat index 62bd9b9c..107acd32 100644 --- a/mapstruct-on-gradle-protobuf3/gradlew.bat +++ b/mapstruct-on-gradle-protobuf3/gradlew.bat @@ -40,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -54,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -64,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/mapstruct-on-gradle-protobuf3/spi-impl/build.gradle b/mapstruct-on-gradle-protobuf3/spi-impl/build.gradle index d029a466..b39371e6 100644 --- a/mapstruct-on-gradle-protobuf3/spi-impl/build.gradle +++ b/mapstruct-on-gradle-protobuf3/spi-impl/build.gradle @@ -3,6 +3,6 @@ apply plugin: 'java' sourceCompatibility = JavaVersion.VERSION_1_8 dependencies { - implementation "org.mapstruct:mapstruct-jdk8:$mapstructVersion" + implementation "org.mapstruct:mapstruct:$mapstructVersion" implementation "org.mapstruct:mapstruct-processor:$mapstructVersion" } diff --git a/mapstruct-on-gradle-protobuf3/usage/build.gradle b/mapstruct-on-gradle-protobuf3/usage/build.gradle index 633640c4..2f2162ca 100644 --- a/mapstruct-on-gradle-protobuf3/usage/build.gradle +++ b/mapstruct-on-gradle-protobuf3/usage/build.gradle @@ -5,10 +5,10 @@ sourceCompatibility = JavaVersion.VERSION_1_8 dependencies { implementation project(':spi-impl') - implementation "org.mapstruct:mapstruct-jdk8:$mapstructVersion" + implementation "org.mapstruct:mapstruct:$mapstructVersion" implementation 'com.google.protobuf:protobuf-java:3.6.1' - testImplementation 'junit:junit:4.12' + testImplementation 'junit:junit:4.13.1' testAnnotationProcessor "org.mapstruct:mapstruct-processor:$mapstructVersion" annotationProcessor "org.mapstruct:mapstruct-processor:$mapstructVersion" diff --git a/mapstruct-on-gradle-protobuf3/usage/src/main/java/org/mapstruct/example/mapper/UserMapper.java b/mapstruct-on-gradle-protobuf3/usage/src/main/java/org/mapstruct/example/mapper/UserMapper.java index 68b6a5ca..b8f0f2e1 100644 --- a/mapstruct-on-gradle-protobuf3/usage/src/main/java/org/mapstruct/example/mapper/UserMapper.java +++ b/mapstruct-on-gradle-protobuf3/usage/src/main/java/org/mapstruct/example/mapper/UserMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - *

- * Licensed 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. +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.mapper; @@ -42,17 +29,17 @@ public interface UserMapper { UserMapper INSTANCE = Mappers.getMapper(UserMapper.class); - @Mapping(source = "permissions", target = "permissionsList") - @Mapping(source = "mainDepartments", target = "mainDepartmentsList") - @Mapping(source = "departments", target = "departmentsList") + @Mapping(target = "permissionsList", source = "permissions") + @Mapping(target = "mainDepartmentsList", source = "mainDepartments") + @Mapping(target = "departmentsList", source = "departments") UserDTO map(User user); - @Mapping(source = "permissionsList", target = "permissions") - @Mapping(source = "mainDepartmentsList", target = "mainDepartments") - @Mapping(source = "departmentsList", target = "departments") + @Mapping(target = "permissions", source = "permissionsList") + @Mapping(target = "mainDepartments", source = "mainDepartmentsList") + @Mapping(target = "departments", source = "departmentsList") User map(UserDTO userDTO); - @ValueMapping(source = "UNRECOGNIZED", target = MappingConstants.NULL) + @ValueMapping(target = MappingConstants.NULL, source = "UNRECOGNIZED") Permission map(PermissionDTO permissionDTO); PermissionDTO map(Permission perm); diff --git a/mapstruct-on-gradle-protobuf3/usage/src/test/java/org/mapstruct/example/ProtobufTest.java b/mapstruct-on-gradle-protobuf3/usage/src/test/java/org/mapstruct/example/ProtobufTest.java index 9f564d93..ac8c0e2e 100644 --- a/mapstruct-on-gradle-protobuf3/usage/src/test/java/org/mapstruct/example/ProtobufTest.java +++ b/mapstruct-on-gradle-protobuf3/usage/src/test/java/org/mapstruct/example/ProtobufTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - *

- * Licensed 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. +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; diff --git a/mapstruct-on-gradle-testcp-with-lombok/build.gradle b/mapstruct-on-gradle-testcp-with-lombok/build.gradle new file mode 100644 index 00000000..7ae0b3ff --- /dev/null +++ b/mapstruct-on-gradle-testcp-with-lombok/build.gradle @@ -0,0 +1,26 @@ +plugins { + id 'java' + id "io.freefair.lombok" version "8.3" +} + +repositories { + mavenCentral() +} + +dependencies { + testImplementation 'org.junit.jupiter:junit-jupiter-api:5.7.0' + testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.7.0' + + annotationProcessor 'org.mapstruct:mapstruct-processor:1.7.0.Beta1' + implementation 'org.mapstruct:mapstruct:1.7.0.Beta1' + + testAnnotationProcessor 'org.mapstruct:mapstruct-processor:1.7.0.Beta1' +} + +lombok { + version = "1.18.30" +} + +test { + useJUnitPlatform() +} diff --git a/mapstruct-on-gradle-testcp-with-lombok/gradle/wrapper/gradle-wrapper.jar b/mapstruct-on-gradle-testcp-with-lombok/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 00000000..e708b1c0 Binary files /dev/null and b/mapstruct-on-gradle-testcp-with-lombok/gradle/wrapper/gradle-wrapper.jar differ diff --git a/mapstruct-on-gradle-testcp-with-lombok/gradle/wrapper/gradle-wrapper.properties b/mapstruct-on-gradle-testcp-with-lombok/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..db9a6b82 --- /dev/null +++ b/mapstruct-on-gradle-testcp-with-lombok/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/mapstruct-on-gradle-testcp-with-lombok/gradlew b/mapstruct-on-gradle-testcp-with-lombok/gradlew new file mode 100755 index 00000000..4f906e0c --- /dev/null +++ b/mapstruct-on-gradle-testcp-with-lombok/gradlew @@ -0,0 +1,185 @@ +#!/usr/bin/env sh + +# +# Copyright 2015 the original author or authors. +# +# Licensed 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 +# +# https://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. +# + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: $0 may be a link +PRG="$0" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*' > /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/" >/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED" >/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "$0"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin or MSYS, switch paths to Windows format before running java +if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=`expr $i + 1` + done + case $i in + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=`save "$@"` + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +exec "$JAVACMD" "$@" diff --git a/mapstruct-on-gradle-testcp-with-lombok/gradlew.bat b/mapstruct-on-gradle-testcp-with-lombok/gradlew.bat new file mode 100644 index 00000000..107acd32 --- /dev/null +++ b/mapstruct-on-gradle-testcp-with-lombok/gradlew.bat @@ -0,0 +1,89 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto execute + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/mapstruct-on-gradle-testcp-with-lombok/settings.gradle b/mapstruct-on-gradle-testcp-with-lombok/settings.gradle new file mode 100644 index 00000000..78c2a92c --- /dev/null +++ b/mapstruct-on-gradle-testcp-with-lombok/settings.gradle @@ -0,0 +1,2 @@ +rootProject.name = 'mapstruct-gradle-in-testclasses' + diff --git a/mapstruct-on-gradle-testcp-with-lombok/src/main/java/de/beanfactory/samples/mapstruct/mapper/SourceTargetMapper.java b/mapstruct-on-gradle-testcp-with-lombok/src/main/java/de/beanfactory/samples/mapstruct/mapper/SourceTargetMapper.java new file mode 100644 index 00000000..7c6cfe24 --- /dev/null +++ b/mapstruct-on-gradle-testcp-with-lombok/src/main/java/de/beanfactory/samples/mapstruct/mapper/SourceTargetMapper.java @@ -0,0 +1,11 @@ +package de.beanfactory.samples.mapstruct.mapper; + +import de.beanfactory.samples.mapstruct.model.SourceBean; +import de.beanfactory.samples.mapstruct.model.TargetBean; +import org.mapstruct.Mapper; + +@Mapper +public interface SourceTargetMapper { + + public TargetBean map(SourceBean source); +} diff --git a/mapstruct-on-gradle-testcp-with-lombok/src/main/java/de/beanfactory/samples/mapstruct/model/SourceBean.java b/mapstruct-on-gradle-testcp-with-lombok/src/main/java/de/beanfactory/samples/mapstruct/model/SourceBean.java new file mode 100644 index 00000000..0a67ee64 --- /dev/null +++ b/mapstruct-on-gradle-testcp-with-lombok/src/main/java/de/beanfactory/samples/mapstruct/model/SourceBean.java @@ -0,0 +1,14 @@ +package de.beanfactory.samples.mapstruct.model; + +import lombok.Data; + +@Data +public class SourceBean { + int id; + String data; + + public SourceBean(int id, String data) { + this.id = id; + this.data = data; + } +} diff --git a/mapstruct-on-gradle-testcp-with-lombok/src/main/java/de/beanfactory/samples/mapstruct/model/TargetBean.java b/mapstruct-on-gradle-testcp-with-lombok/src/main/java/de/beanfactory/samples/mapstruct/model/TargetBean.java new file mode 100644 index 00000000..262e882d --- /dev/null +++ b/mapstruct-on-gradle-testcp-with-lombok/src/main/java/de/beanfactory/samples/mapstruct/model/TargetBean.java @@ -0,0 +1,9 @@ +package de.beanfactory.samples.mapstruct.model; + +import lombok.Data; + +@Data +public class TargetBean { + int id; + String data; +} diff --git a/mapstruct-on-gradle-testcp-with-lombok/src/test/java/de/beanfactory/samples/mapstruct/mapper/SourceTargetMapperTest.java b/mapstruct-on-gradle-testcp-with-lombok/src/test/java/de/beanfactory/samples/mapstruct/mapper/SourceTargetMapperTest.java new file mode 100644 index 00000000..ef86e841 --- /dev/null +++ b/mapstruct-on-gradle-testcp-with-lombok/src/test/java/de/beanfactory/samples/mapstruct/mapper/SourceTargetMapperTest.java @@ -0,0 +1,23 @@ +package de.beanfactory.samples.mapstruct.mapper; + +import de.beanfactory.samples.mapstruct.model.SourceBean; +import de.beanfactory.samples.mapstruct.model.TargetBean; +import org.junit.jupiter.api.Test; +import org.mapstruct.factory.Mappers; + +import static org.junit.jupiter.api.Assertions.*; + +class SourceTargetMapperTest { + + @Test + void itShouldMapSourceToTargetBean() { + SourceTargetMapper mapper = Mappers.getMapper(SourceTargetMapper.class); + + SourceBean sourceBean = new SourceBean(0, "datastring"); + TargetBean targetBean = mapper.map(sourceBean); + + assertEquals(sourceBean.getId(), targetBean.getId()); + assertEquals(sourceBean.getData(), targetBean.getData()); + } + +} \ No newline at end of file diff --git a/mapstruct-on-gradle-testcp-with-lombok/src/test/java/de/beanfactory/samples/mapstruct/mapper/TestSourceMapper.java b/mapstruct-on-gradle-testcp-with-lombok/src/test/java/de/beanfactory/samples/mapstruct/mapper/TestSourceMapper.java new file mode 100644 index 00000000..8f785931 --- /dev/null +++ b/mapstruct-on-gradle-testcp-with-lombok/src/test/java/de/beanfactory/samples/mapstruct/mapper/TestSourceMapper.java @@ -0,0 +1,11 @@ +package de.beanfactory.samples.mapstruct.mapper; + +import de.beanfactory.samples.mapstruct.model.TestSourceBean; +import de.beanfactory.samples.mapstruct.model.TestTargetBean; +import org.mapstruct.Mapper; + +@Mapper +public interface TestSourceMapper { + + TestTargetBean map(TestSourceBean testSource); +} diff --git a/mapstruct-on-gradle-testcp-with-lombok/src/test/java/de/beanfactory/samples/mapstruct/mapper/TestSourceTargetMapperTest.java b/mapstruct-on-gradle-testcp-with-lombok/src/test/java/de/beanfactory/samples/mapstruct/mapper/TestSourceTargetMapperTest.java new file mode 100644 index 00000000..56d5d584 --- /dev/null +++ b/mapstruct-on-gradle-testcp-with-lombok/src/test/java/de/beanfactory/samples/mapstruct/mapper/TestSourceTargetMapperTest.java @@ -0,0 +1,25 @@ +package de.beanfactory.samples.mapstruct.mapper; + +import de.beanfactory.samples.mapstruct.model.SourceBean; +import de.beanfactory.samples.mapstruct.model.TargetBean; +import de.beanfactory.samples.mapstruct.model.TestSourceBean; +import de.beanfactory.samples.mapstruct.model.TestTargetBean; +import org.junit.jupiter.api.Test; +import org.mapstruct.factory.Mappers; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +class TestSourceTargetMapperTest { + + @Test + void itShouldMapTestSourceToTestTargetBean() { + TestSourceMapper mapper = Mappers.getMapper(TestSourceMapper.class); + + TestSourceBean sourceBean = new TestSourceBean(0, "datastring"); + TestTargetBean targetBean = mapper.map(sourceBean); + + assertEquals(sourceBean.getId(), targetBean.getId()); + assertEquals(sourceBean.getData(), targetBean.getData()); + } + +} \ No newline at end of file diff --git a/mapstruct-on-gradle-testcp-with-lombok/src/test/java/de/beanfactory/samples/mapstruct/model/TestSourceBean.java b/mapstruct-on-gradle-testcp-with-lombok/src/test/java/de/beanfactory/samples/mapstruct/model/TestSourceBean.java new file mode 100644 index 00000000..314a0d98 --- /dev/null +++ b/mapstruct-on-gradle-testcp-with-lombok/src/test/java/de/beanfactory/samples/mapstruct/model/TestSourceBean.java @@ -0,0 +1,14 @@ +package de.beanfactory.samples.mapstruct.model; + +import lombok.Data; + +@Data +public class TestSourceBean { + private int id; + private String data; + + public TestSourceBean(int id, String data) { + this.id = id; + this.data = data; + } +} diff --git a/mapstruct-on-gradle-testcp-with-lombok/src/test/java/de/beanfactory/samples/mapstruct/model/TestTargetBean.java b/mapstruct-on-gradle-testcp-with-lombok/src/test/java/de/beanfactory/samples/mapstruct/model/TestTargetBean.java new file mode 100644 index 00000000..79ac03dd --- /dev/null +++ b/mapstruct-on-gradle-testcp-with-lombok/src/test/java/de/beanfactory/samples/mapstruct/model/TestTargetBean.java @@ -0,0 +1,10 @@ +package de.beanfactory.samples.mapstruct.model; + +import java.util.Objects; +import lombok.Data; + +@Data +public class TestTargetBean { + private int id; + private String data; +} diff --git a/mapstruct-on-gradle/build.gradle b/mapstruct-on-gradle/build.gradle index 466e5bad..27bf4c75 100644 --- a/mapstruct-on-gradle/build.gradle +++ b/mapstruct-on-gradle/build.gradle @@ -8,7 +8,7 @@ repositories { } ext { - mapstructVersion = "1.3.1.Final" + mapstructVersion = "1.7.0.Beta1" } sourceCompatibility = JavaVersion.VERSION_1_8 @@ -16,7 +16,7 @@ sourceCompatibility = JavaVersion.VERSION_1_8 dependencies { implementation "org.mapstruct:mapstruct:${mapstructVersion}" testImplementation "org.testng:testng:6.10", "org.easytesting:fest-assert:1.4" - annotationProcessor "org.mapstruct:mapstruct-processor:1.3.1.Final" + annotationProcessor "org.mapstruct:mapstruct-processor:1.7.0.Beta1" } tasks.withType(JavaCompile) { diff --git a/mapstruct-on-gradle/gradle/wrapper/gradle-wrapper.jar b/mapstruct-on-gradle/gradle/wrapper/gradle-wrapper.jar index 5c2d1cf0..e708b1c0 100644 Binary files a/mapstruct-on-gradle/gradle/wrapper/gradle-wrapper.jar and b/mapstruct-on-gradle/gradle/wrapper/gradle-wrapper.jar differ diff --git a/mapstruct-on-gradle/gradle/wrapper/gradle-wrapper.properties b/mapstruct-on-gradle/gradle/wrapper/gradle-wrapper.properties index b7c8c5db..db9a6b82 100644 --- a/mapstruct-on-gradle/gradle/wrapper/gradle-wrapper.properties +++ b/mapstruct-on-gradle/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/mapstruct-on-gradle/gradlew b/mapstruct-on-gradle/gradlew index 83f2acfd..4f906e0c 100755 --- a/mapstruct-on-gradle/gradlew +++ b/mapstruct-on-gradle/gradlew @@ -82,6 +82,7 @@ esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + # Determine the Java command to use to start the JVM. if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then @@ -129,6 +130,7 @@ fi if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then APP_HOME=`cygpath --path --mixed "$APP_HOME"` CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` # We build the pattern for arguments to be converted via cygpath @@ -154,19 +156,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then else eval `echo args$i`="\"$arg\"" fi - i=$((i+1)) + i=`expr $i + 1` done case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + 0) set -- ;; + 1) set -- "$args0" ;; + 2) set -- "$args0" "$args1" ;; + 3) set -- "$args0" "$args1" "$args2" ;; + 4) set -- "$args0" "$args1" "$args2" "$args3" ;; + 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; esac fi @@ -175,14 +177,9 @@ save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -APP_ARGS=$(save "$@") +APP_ARGS=`save "$@"` # Collect all arguments for the java command, following the shell quoting and substitution rules eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "$0")" -fi - exec "$JAVACMD" "$@" diff --git a/mapstruct-on-gradle/gradlew.bat b/mapstruct-on-gradle/gradlew.bat index 9618d8d9..107acd32 100644 --- a/mapstruct-on-gradle/gradlew.bat +++ b/mapstruct-on-gradle/gradlew.bat @@ -29,6 +29,9 @@ if "%DIRNAME%" == "" set DIRNAME=. set APP_BASE_NAME=%~n0 set APP_HOME=%DIRNAME% +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" @@ -37,7 +40,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome set JAVA_EXE=java.exe %JAVA_EXE% -version >NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init +if "%ERRORLEVEL%" == "0" goto execute echo. echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. @@ -51,7 +54,7 @@ goto fail set JAVA_HOME=%JAVA_HOME:"=% set JAVA_EXE=%JAVA_HOME%/bin/java.exe -if exist "%JAVA_EXE%" goto init +if exist "%JAVA_EXE%" goto execute echo. echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% @@ -61,28 +64,14 @@ echo location of your Java installation. goto fail -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - :execute @rem Setup the command line set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* :end @rem End local scope for the variables with windows NT shell diff --git a/mapstruct-on-gradle/src/main/java/org/mapstruct/example/Source.java b/mapstruct-on-gradle/src/main/java/org/mapstruct/example/Source.java index daf483c2..234c6055 100644 --- a/mapstruct-on-gradle/src/main/java/org/mapstruct/example/Source.java +++ b/mapstruct-on-gradle/src/main/java/org/mapstruct/example/Source.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; diff --git a/mapstruct-on-gradle/src/main/java/org/mapstruct/example/SourceTargetMapper.java b/mapstruct-on-gradle/src/main/java/org/mapstruct/example/SourceTargetMapper.java index c0abe930..79ebd8c7 100644 --- a/mapstruct-on-gradle/src/main/java/org/mapstruct/example/SourceTargetMapper.java +++ b/mapstruct-on-gradle/src/main/java/org/mapstruct/example/SourceTargetMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; @@ -28,8 +15,8 @@ public interface SourceTargetMapper { SourceTargetMapper INSTANCE = Mappers.getMapper(SourceTargetMapper.class); - @Mapping(source = "qax", target = "baz") - @Mapping(source = "baz", target = "qax") + @Mapping(target = "baz", source = "qax") + @Mapping(target = "qax", source = "baz") Target sourceToTarget(Source source); @InheritInverseConfiguration diff --git a/mapstruct-on-gradle/src/main/java/org/mapstruct/example/Target.java b/mapstruct-on-gradle/src/main/java/org/mapstruct/example/Target.java index 8f704bab..74848972 100644 --- a/mapstruct-on-gradle/src/main/java/org/mapstruct/example/Target.java +++ b/mapstruct-on-gradle/src/main/java/org/mapstruct/example/Target.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; diff --git a/mapstruct-on-gradle/src/test/java/org/mapstruct/example/ConversionTest.java b/mapstruct-on-gradle/src/test/java/org/mapstruct/example/ConversionTest.java index 9e5ac9b3..a174dbba 100644 --- a/mapstruct-on-gradle/src/test/java/org/mapstruct/example/ConversionTest.java +++ b/mapstruct-on-gradle/src/test/java/org/mapstruct/example/ConversionTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; diff --git a/mapstruct-protobuf3/pom.xml b/mapstruct-protobuf3/pom.xml index 7fe7ebb1..d5fe4fd2 100644 --- a/mapstruct-protobuf3/pom.xml +++ b/mapstruct-protobuf3/pom.xml @@ -1,22 +1,9 @@ UTF-8 - 1.4.0.Final - 0.5.0 - 3.2.0 - 1.3.1.Final + 1.7.1 + 0.6.1 + 4.27.3 + 1.7.0.Beta1 1.8 1.8 @@ -60,7 +47,7 @@ junit junit - 4.12 + 4.13.1 @@ -71,7 +58,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.14.1 diff --git a/mapstruct-protobuf3/spi-impl/pom.xml b/mapstruct-protobuf3/spi-impl/pom.xml index 7bfd7d5f..86a73346 100644 --- a/mapstruct-protobuf3/spi-impl/pom.xml +++ b/mapstruct-protobuf3/spi-impl/pom.xml @@ -1,22 +1,9 @@ junit junit - 4.12 + 4.13.1 test @@ -72,10 +59,10 @@ compile-custom - com.google.protobuf:protoc:3.2.0:exe:${os.detected.classifier} + com.google.protobuf:protoc:${protobuf.java.version}:exe:${os.detected.classifier} grpc-java - io.grpc:protoc-gen-grpc-java:1.2.0:exe:${os.detected.classifier} + io.grpc:protoc-gen-grpc-java:1.66.0:exe:${os.detected.classifier} diff --git a/mapstruct-protobuf3/usage/src/main/java/org/mapstruct/example/mapper/UserMapper.java b/mapstruct-protobuf3/usage/src/main/java/org/mapstruct/example/mapper/UserMapper.java index 68b6a5ca..b8f0f2e1 100644 --- a/mapstruct-protobuf3/usage/src/main/java/org/mapstruct/example/mapper/UserMapper.java +++ b/mapstruct-protobuf3/usage/src/main/java/org/mapstruct/example/mapper/UserMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - *

- * Licensed 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. +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.mapper; @@ -42,17 +29,17 @@ public interface UserMapper { UserMapper INSTANCE = Mappers.getMapper(UserMapper.class); - @Mapping(source = "permissions", target = "permissionsList") - @Mapping(source = "mainDepartments", target = "mainDepartmentsList") - @Mapping(source = "departments", target = "departmentsList") + @Mapping(target = "permissionsList", source = "permissions") + @Mapping(target = "mainDepartmentsList", source = "mainDepartments") + @Mapping(target = "departmentsList", source = "departments") UserDTO map(User user); - @Mapping(source = "permissionsList", target = "permissions") - @Mapping(source = "mainDepartmentsList", target = "mainDepartments") - @Mapping(source = "departmentsList", target = "departments") + @Mapping(target = "permissions", source = "permissionsList") + @Mapping(target = "mainDepartments", source = "mainDepartmentsList") + @Mapping(target = "departments", source = "departmentsList") User map(UserDTO userDTO); - @ValueMapping(source = "UNRECOGNIZED", target = MappingConstants.NULL) + @ValueMapping(target = MappingConstants.NULL, source = "UNRECOGNIZED") Permission map(PermissionDTO permissionDTO); PermissionDTO map(Permission perm); diff --git a/mapstruct-protobuf3/usage/src/test/java/org/mapstruct/example/ProtobufTest.java b/mapstruct-protobuf3/usage/src/test/java/org/mapstruct/example/ProtobufTest.java index 9f564d93..ac8c0e2e 100644 --- a/mapstruct-protobuf3/usage/src/test/java/org/mapstruct/example/ProtobufTest.java +++ b/mapstruct-protobuf3/usage/src/test/java/org/mapstruct/example/ProtobufTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - *

- * Licensed 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. +/* + * Copyright MapStruct Authors. + * + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; diff --git a/mapstruct-quarkus/.mvn/wrapper/MavenWrapperDownloader.java b/mapstruct-quarkus/.mvn/wrapper/MavenWrapperDownloader.java index c32394f1..b901097f 100644 --- a/mapstruct-quarkus/.mvn/wrapper/MavenWrapperDownloader.java +++ b/mapstruct-quarkus/.mvn/wrapper/MavenWrapperDownloader.java @@ -20,7 +20,7 @@ public class MavenWrapperDownloader { - private static final String WRAPPER_VERSION = "0.5.5"; + private static final String WRAPPER_VERSION = "0.5.6"; /** * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. */ diff --git a/mapstruct-quarkus/.mvn/wrapper/maven-wrapper.properties b/mapstruct-quarkus/.mvn/wrapper/maven-wrapper.properties index 7d59a01f..642d572c 100644 --- a/mapstruct-quarkus/.mvn/wrapper/maven-wrapper.properties +++ b/mapstruct-quarkus/.mvn/wrapper/maven-wrapper.properties @@ -1,2 +1,2 @@ -distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip -wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar +distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip +wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar diff --git a/mapstruct-quarkus/pom.xml b/mapstruct-quarkus/pom.xml index fbb12f4d..89390e3c 100644 --- a/mapstruct-quarkus/pom.xml +++ b/mapstruct-quarkus/pom.xml @@ -1,22 +1,9 @@ 1.0-SNAPSHOT - 3.8.1 + 3.14.1 true 1.8 1.8 UTF-8 UTF-8 1.0.1.Final - quarkus-universe-bom + quarkus-bom io.quarkus - 1.0.1.Final - 2.22.1 + 1.13.6.Final + 1.13.6.Final + 3.0.0-M5 - 1.3.1.Final + 1.7.0.Beta1 @@ -114,6 +102,7 @@ org.jboss.logmanager.LogManager + ${maven.home} @@ -142,6 +131,8 @@ ${project.build.directory}/${project.build.finalName}-runner + org.jboss.logmanager.LogManager + ${maven.home} diff --git a/mapstruct-quarkus/src/main/docker/Dockerfile.jvm b/mapstruct-quarkus/src/main/docker/Dockerfile.jvm index bb551575..f185a1e5 100644 --- a/mapstruct-quarkus/src/main/docker/Dockerfile.jvm +++ b/mapstruct-quarkus/src/main/docker/Dockerfile.jvm @@ -1,31 +1,54 @@ #### # This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode # -# Before building the docker image run: +# Before building the container image run: # -# mvn package +# ./mvnw package # # Then, build the image with: # -# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/mapstruct-examples-quarkus-jvm . +# docker build -f src/main/docker/Dockerfile.jvm -t quarkus/getting-started-jvm . # # Then run the container using: # -# docker run -i --rm -p 8080:8080 quarkus/mapstruct-examples-quarkus-jvm +# docker run -i --rm -p 8080:8080 quarkus/getting-started-jvm +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5050 +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/getting-started-jvm # ### -FROM fabric8/java-alpine-openjdk8-jre +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3 + +ARG JAVA_PACKAGE=java-11-openjdk-headless +ARG RUN_JAVA_VERSION=1.3.8 +ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' +# Install java and the run-java script +# Also set up permissions for user `1001` +RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \ + && microdnf update \ + && microdnf clean all \ + && mkdir /deployments \ + && chown 1001 /deployments \ + && chmod "g+rwX" /deployments \ + && chown 1001:root /deployments \ + && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \ + && chown 1001 /deployments/run-java.sh \ + && chmod 540 /deployments/run-java.sh \ + && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/lib/security/java.security + +# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size. ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" -ENV AB_ENABLED=jmx_exporter -COPY target/lib/* /deployments/lib/ -COPY target/*-runner.jar /deployments/app.jar -EXPOSE 8080 +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --chown=1001 target/quarkus-app/lib/ /deployments/lib/ +COPY --chown=1001 target/quarkus-app/*.jar /deployments/ +COPY --chown=1001 target/quarkus-app/app/ /deployments/app/ +COPY --chown=1001 target/quarkus-app/quarkus/ /deployments/quarkus/ -# run with user 1001 and be prepared for be running in OpenShift too -RUN adduser -G root --no-create-home --disabled-password 1001 \ - && chown -R 1001 /deployments \ - && chmod -R "g+rwX" /deployments \ - && chown -R 1001:root /deployments +EXPOSE 8080 USER 1001 -ENTRYPOINT [ "/deployments/run-java.sh" ] \ No newline at end of file +ENTRYPOINT [ "/deployments/run-java.sh" ] diff --git a/mapstruct-quarkus/src/main/docker/Dockerfile.legacy-jar b/mapstruct-quarkus/src/main/docker/Dockerfile.legacy-jar new file mode 100644 index 00000000..16b4dc7e --- /dev/null +++ b/mapstruct-quarkus/src/main/docker/Dockerfile.legacy-jar @@ -0,0 +1,51 @@ +#### +# This Dockerfile is used in order to build a container that runs the Quarkus application in JVM mode +# +# Before building the container image run: +# +# ./mvnw package -Dquarkus.package.type=legacy-jar +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.legacy-jar -t quarkus/getting-started-legacy-jar . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/getting-started-legacy-jar +# +# If you want to include the debug port into your docker image +# you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5050 +# +# Then run the container using : +# +# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/getting-started-legacy-jar +# +### +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3 + +ARG JAVA_PACKAGE=java-11-openjdk-headless +ARG RUN_JAVA_VERSION=1.3.8 +ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' +# Install java and the run-java script +# Also set up permissions for user `1001` +RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \ + && microdnf update \ + && microdnf clean all \ + && mkdir /deployments \ + && chown 1001 /deployments \ + && chmod "g+rwX" /deployments \ + && chown 1001:root /deployments \ + && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \ + && chown 1001 /deployments/run-java.sh \ + && chmod 540 /deployments/run-java.sh \ + && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/lib/security/java.security + +# Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size. +ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +COPY target/lib/* /deployments/lib/ +COPY target/*-runner.jar /deployments/app.jar + +EXPOSE 8080 +USER 1001 + +ENTRYPOINT [ "/deployments/run-java.sh" ] diff --git a/mapstruct-quarkus/src/main/docker/Dockerfile.native b/mapstruct-quarkus/src/main/docker/Dockerfile.native index 6e719b37..7400c006 100644 --- a/mapstruct-quarkus/src/main/docker/Dockerfile.native +++ b/mapstruct-quarkus/src/main/docker/Dockerfile.native @@ -1,22 +1,27 @@ #### # This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode # -# Before building the docker image run: +# Before building the container image run: # -# mvn package -Pnative -Dquarkus.native.container-build=true +# ./mvnw package -Pnative # # Then, build the image with: # -# docker build -f src/main/docker/Dockerfile.native -t quarkus/mapstruct-examples-quarkus . +# docker build -f src/main/docker/Dockerfile.native -t quarkus/getting-started . # # Then run the container using: # -# docker run -i --rm -p 8080:8080 quarkus/mapstruct-examples-quarkus +# docker run -i --rm -p 8080:8080 quarkus/getting-started # ### -FROM registry.access.redhat.com/ubi8/ubi-minimal +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.3 WORKDIR /work/ -COPY target/*-runner /work/application -RUN chmod 775 /work +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root target/*-runner /work/application + EXPOSE 8080 -CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] \ No newline at end of file +USER 1001 + +CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/mapstruct-quarkus/src/main/docker/Dockerfile.native-distroless b/mapstruct-quarkus/src/main/docker/Dockerfile.native-distroless new file mode 100644 index 00000000..634552f9 --- /dev/null +++ b/mapstruct-quarkus/src/main/docker/Dockerfile.native-distroless @@ -0,0 +1,23 @@ +#### +# This Dockerfile is used in order to build a distroless container that runs the Quarkus application in native (no JVM) mode +# +# Before building the container image run: +# +# ./mvnw package -Pnative +# +# Then, build the image with: +# +# docker build -f src/main/docker/Dockerfile.native-distroless -t quarkus/getting-started . +# +# Then run the container using: +# +# docker run -i --rm -p 8080:8080 quarkus/getting-started +# +### +FROM quay.io/quarkus/quarkus-distroless-image:1.0 +COPY target/*-runner /application + +EXPOSE 8080 +USER nonroot + +CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/PersonResource.java b/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/PersonResource.java index 94408e3e..f247eb33 100644 --- a/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/PersonResource.java +++ b/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/PersonResource.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.quarkus; diff --git a/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/dto/PersonDto.java b/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/dto/PersonDto.java index 8993d063..e8aae41b 100644 --- a/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/dto/PersonDto.java +++ b/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/dto/PersonDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.quarkus.dto; diff --git a/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/mapper/PersonMapper.java b/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/mapper/PersonMapper.java index 41fe8d39..56e7baed 100644 --- a/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/mapper/PersonMapper.java +++ b/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/mapper/PersonMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.quarkus.mapper; diff --git a/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/mapper/QuarkusMappingConfig.java b/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/mapper/QuarkusMappingConfig.java index 20797e8a..1973900b 100644 --- a/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/mapper/QuarkusMappingConfig.java +++ b/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/mapper/QuarkusMappingConfig.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.quarkus.mapper; diff --git a/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/service/Person.java b/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/service/Person.java index 0ee76ab6..8f16235c 100644 --- a/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/service/Person.java +++ b/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/service/Person.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.quarkus.service; diff --git a/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/service/PersonService.java b/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/service/PersonService.java index 45618ff2..b8e138ce 100644 --- a/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/service/PersonService.java +++ b/mapstruct-quarkus/src/main/java/org/mapstruct/example/quarkus/service/PersonService.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.quarkus.service; diff --git a/mapstruct-quarkus/src/test/java/org/mapstruct/example/quarkus/NativePersonResourceIT.java b/mapstruct-quarkus/src/test/java/org/mapstruct/example/quarkus/NativePersonResourceIT.java index a184af09..9f2d3c3b 100644 --- a/mapstruct-quarkus/src/test/java/org/mapstruct/example/quarkus/NativePersonResourceIT.java +++ b/mapstruct-quarkus/src/test/java/org/mapstruct/example/quarkus/NativePersonResourceIT.java @@ -1,27 +1,14 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.quarkus; -import io.quarkus.test.junit.SubstrateTest; +import io.quarkus.test.junit.NativeImageTest; -@SubstrateTest +@NativeImageTest public class NativePersonResourceIT extends PersonResourceTest { // Execute the same tests but in native mode. -} \ No newline at end of file +} diff --git a/mapstruct-quarkus/src/test/java/org/mapstruct/example/quarkus/PersonResourceTest.java b/mapstruct-quarkus/src/test/java/org/mapstruct/example/quarkus/PersonResourceTest.java index 2f90b760..c183645e 100644 --- a/mapstruct-quarkus/src/test/java/org/mapstruct/example/quarkus/PersonResourceTest.java +++ b/mapstruct-quarkus/src/test/java/org/mapstruct/example/quarkus/PersonResourceTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.quarkus; diff --git a/mapstruct-record/pom.xml b/mapstruct-record/pom.xml index ae19cfb0..7564c43a 100644 --- a/mapstruct-record/pom.xml +++ b/mapstruct-record/pom.xml @@ -1,22 +1,9 @@ UTF-8 - 14 + 16 ${java.version} ${java.version} ${java.version} - 1.4.0-SNAPSHOT + 1.7.0.Beta1 @@ -57,12 +44,12 @@ junit junit test - 4.12 + 4.13.1 org.assertj assertj-core - 3.14.0 + 3.27.7 test @@ -72,9 +59,8 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.0 + 3.14.1 - --enable-preview org.mapstruct @@ -88,22 +74,18 @@ org.apache.maven.plugins maven-surefire-plugin 3.0.0-M4 - - 1 - --enable-preview - - java15 + java17 - 15 + 17 - 15 + 17 diff --git a/mapstruct-record/src/main/java/org/mapstruct/example/CustomerMapper.java b/mapstruct-record/src/main/java/org/mapstruct/example/CustomerMapper.java index a8902d65..99dc71a7 100644 --- a/mapstruct-record/src/main/java/org/mapstruct/example/CustomerMapper.java +++ b/mapstruct-record/src/main/java/org/mapstruct/example/CustomerMapper.java @@ -5,6 +5,7 @@ */ package org.mapstruct.example; +import org.mapstruct.InheritInverseConfiguration; import org.mapstruct.Mapper; import org.mapstruct.Mapping; import org.mapstruct.factory.Mappers; @@ -20,4 +21,7 @@ public interface CustomerMapper { @Mapping(target = "mail", source = "email") CustomerEntity fromRecord(CustomerDto record); + @InheritInverseConfiguration + CustomerDto toRecord(CustomerEntity entity); + } diff --git a/mapstruct-record/src/test/java/org/mapstruct/example/CustomerMapperTest.java b/mapstruct-record/src/test/java/org/mapstruct/example/CustomerMapperTest.java index 1dc5b4f1..1f917eb7 100644 --- a/mapstruct-record/src/test/java/org/mapstruct/example/CustomerMapperTest.java +++ b/mapstruct-record/src/test/java/org/mapstruct/example/CustomerMapperTest.java @@ -22,4 +22,17 @@ public void mapRecords() { assertThat( customer.getName() ).isEqualTo( "Kermit" ); assertThat( customer.getMail() ).isEqualTo( "kermit@test.com" ); } + + @Test + public void mapToRecords() { + CustomerEntity entity = new CustomerEntity(); + entity.setName( "Fozzie" ); + entity.setMail( "fozzie@test.com" ); + + CustomerDto customer = CustomerMapper.INSTANCE.toRecord( entity ); + + assertThat( customer ).isNotNull(); + assertThat( customer.name() ).isEqualTo( "Fozzie" ); + assertThat( customer.email() ).isEqualTo( "fozzie@test.com" ); + } } diff --git a/mapstruct-rounding/pom.xml b/mapstruct-rounding/pom.xml index b68dc2dc..b5e6bd4c 100644 --- a/mapstruct-rounding/pom.xml +++ b/mapstruct-rounding/pom.xml @@ -1,22 +1,9 @@ @@ -27,7 +14,7 @@ UTF-8 - 1.3.1.Final + 1.7.0.Beta1 @@ -40,7 +27,7 @@ junit junit - 4.12 + 4.13.1 test @@ -51,7 +38,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.14.1 1.8 1.8 diff --git a/mapstruct-rounding/src/main/java/org/mapstruct/example/dto/Source.java b/mapstruct-rounding/src/main/java/org/mapstruct/example/dto/Source.java index d0881335..b77c892b 100644 --- a/mapstruct-rounding/src/main/java/org/mapstruct/example/dto/Source.java +++ b/mapstruct-rounding/src/main/java/org/mapstruct/example/dto/Source.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-rounding/src/main/java/org/mapstruct/example/dto/Target.java b/mapstruct-rounding/src/main/java/org/mapstruct/example/dto/Target.java index 4e791f08..7f88c3de 100644 --- a/mapstruct-rounding/src/main/java/org/mapstruct/example/dto/Target.java +++ b/mapstruct-rounding/src/main/java/org/mapstruct/example/dto/Target.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-rounding/src/main/java/org/mapstruct/example/mapper/SourceTargetMapper.java b/mapstruct-rounding/src/main/java/org/mapstruct/example/mapper/SourceTargetMapper.java index 9d9430e1..3db7935c 100644 --- a/mapstruct-rounding/src/main/java/org/mapstruct/example/mapper/SourceTargetMapper.java +++ b/mapstruct-rounding/src/main/java/org/mapstruct/example/mapper/SourceTargetMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.mapper; diff --git a/mapstruct-rounding/src/main/java/org/mapstruct/example/mapper/util/RoundingUtil.java b/mapstruct-rounding/src/main/java/org/mapstruct/example/mapper/util/RoundingUtil.java index 1dab5824..8692f229 100644 --- a/mapstruct-rounding/src/main/java/org/mapstruct/example/mapper/util/RoundingUtil.java +++ b/mapstruct-rounding/src/main/java/org/mapstruct/example/mapper/util/RoundingUtil.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.mapper.util; diff --git a/mapstruct-rounding/src/test/java/org/mapstruct/example/SourceTargetMapperTest.java b/mapstruct-rounding/src/test/java/org/mapstruct/example/SourceTargetMapperTest.java index 81a30981..a6eb0756 100644 --- a/mapstruct-rounding/src/test/java/org/mapstruct/example/SourceTargetMapperTest.java +++ b/mapstruct-rounding/src/test/java/org/mapstruct/example/SourceTargetMapperTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; diff --git a/mapstruct-spi-accessor-naming/pom.xml b/mapstruct-spi-accessor-naming/pom.xml index 3ab7279b..1ed623a8 100644 --- a/mapstruct-spi-accessor-naming/pom.xml +++ b/mapstruct-spi-accessor-naming/pom.xml @@ -1,22 +1,9 @@ @@ -29,7 +16,7 @@ UTF-8 - 1.3.1.Final + 1.7.0.Beta1 1.8 1.8 @@ -56,7 +43,7 @@ junit junit - 4.12 + 4.13.1 @@ -67,7 +54,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.14.1 diff --git a/mapstruct-spi-accessor-naming/spi-impl/pom.xml b/mapstruct-spi-accessor-naming/spi-impl/pom.xml index fec57fc0..16df89b5 100644 --- a/mapstruct-spi-accessor-naming/spi-impl/pom.xml +++ b/mapstruct-spi-accessor-naming/spi-impl/pom.xml @@ -1,22 +1,9 @@ diff --git a/mapstruct-spi-accessor-naming/spi-impl/src/main/java/org/mapstruct/example/spi/CustomAccessorNamingStrategy.java b/mapstruct-spi-accessor-naming/spi-impl/src/main/java/org/mapstruct/example/spi/CustomAccessorNamingStrategy.java index 28fe2128..8ddb8995 100644 --- a/mapstruct-spi-accessor-naming/spi-impl/src/main/java/org/mapstruct/example/spi/CustomAccessorNamingStrategy.java +++ b/mapstruct-spi-accessor-naming/spi-impl/src/main/java/org/mapstruct/example/spi/CustomAccessorNamingStrategy.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.spi; diff --git a/mapstruct-spi-accessor-naming/usage/pom.xml b/mapstruct-spi-accessor-naming/usage/pom.xml index c2149e59..a47c5787 100644 --- a/mapstruct-spi-accessor-naming/usage/pom.xml +++ b/mapstruct-spi-accessor-naming/usage/pom.xml @@ -1,22 +1,9 @@ @@ -40,7 +27,7 @@ junit junit - 4.12 + 4.13.1 test diff --git a/mapstruct-spi-accessor-naming/usage/src/main/java/org/mapstruct/example/dto/GolfPlayer.java b/mapstruct-spi-accessor-naming/usage/src/main/java/org/mapstruct/example/dto/GolfPlayer.java index 0eecd317..f019b74b 100644 --- a/mapstruct-spi-accessor-naming/usage/src/main/java/org/mapstruct/example/dto/GolfPlayer.java +++ b/mapstruct-spi-accessor-naming/usage/src/main/java/org/mapstruct/example/dto/GolfPlayer.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-spi-accessor-naming/usage/src/main/java/org/mapstruct/example/dto/GolfPlayerDto.java b/mapstruct-spi-accessor-naming/usage/src/main/java/org/mapstruct/example/dto/GolfPlayerDto.java index 197ae369..a6d2ab32 100644 --- a/mapstruct-spi-accessor-naming/usage/src/main/java/org/mapstruct/example/dto/GolfPlayerDto.java +++ b/mapstruct-spi-accessor-naming/usage/src/main/java/org/mapstruct/example/dto/GolfPlayerDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-spi-accessor-naming/usage/src/main/java/org/mapstruct/example/mapper/GolfPlayerMapper.java b/mapstruct-spi-accessor-naming/usage/src/main/java/org/mapstruct/example/mapper/GolfPlayerMapper.java index 421d5790..580dfb01 100644 --- a/mapstruct-spi-accessor-naming/usage/src/main/java/org/mapstruct/example/mapper/GolfPlayerMapper.java +++ b/mapstruct-spi-accessor-naming/usage/src/main/java/org/mapstruct/example/mapper/GolfPlayerMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.mapper; diff --git a/mapstruct-spi-accessor-naming/usage/src/test/java/org/mapstruct/example/SpiTest.java b/mapstruct-spi-accessor-naming/usage/src/test/java/org/mapstruct/example/SpiTest.java index 999bcb50..20f9a8d5 100644 --- a/mapstruct-spi-accessor-naming/usage/src/test/java/org/mapstruct/example/SpiTest.java +++ b/mapstruct-spi-accessor-naming/usage/src/test/java/org/mapstruct/example/SpiTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; diff --git a/mapstruct-suppress-unmapped/pom.xml b/mapstruct-suppress-unmapped/pom.xml index 5eb32bfa..af0bdd08 100644 --- a/mapstruct-suppress-unmapped/pom.xml +++ b/mapstruct-suppress-unmapped/pom.xml @@ -1,22 +1,9 @@ @@ -27,7 +14,7 @@ UTF-8 - 1.3.1.Final + 1.7.0.Beta1 1.8 1.8 @@ -50,14 +37,14 @@ junit junit - 4.12 + 4.13.1 test org.assertj assertj-core - 3.9.0 + 3.27.7 test @@ -68,7 +55,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.14.1 diff --git a/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/ChildDto.java b/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/ChildDto.java index 794256be..f0fcbd03 100644 --- a/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/ChildDto.java +++ b/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/ChildDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/ChildEntity.java b/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/ChildEntity.java index 9c71be05..6072cd7e 100644 --- a/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/ChildEntity.java +++ b/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/ChildEntity.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/ParentDto.java b/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/ParentDto.java index d427efb5..339ef89e 100644 --- a/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/ParentDto.java +++ b/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/ParentDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/ParentEntity.java b/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/ParentEntity.java index f349ae38..f6c5a38b 100644 --- a/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/ParentEntity.java +++ b/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/ParentEntity.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java b/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java index 4f263e3b..6ee1a6d2 100644 --- a/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java +++ b/mapstruct-suppress-unmapped/src/main/java/org/mapstruct/jpa/SourceTargetMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-suppress-unmapped/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java b/mapstruct-suppress-unmapped/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java index 80fce5be..11bacdbc 100644 --- a/mapstruct-suppress-unmapped/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java +++ b/mapstruct-suppress-unmapped/src/test/java/org/mapstruct/jpa/SourceTargetMapperTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.jpa; diff --git a/mapstruct-updatemethods-1/pom.xml b/mapstruct-updatemethods-1/pom.xml index 87f0d29f..3931bdb5 100644 --- a/mapstruct-updatemethods-1/pom.xml +++ b/mapstruct-updatemethods-1/pom.xml @@ -1,22 +1,9 @@ @@ -27,7 +14,7 @@ UTF-8 - 1.3.1.Final + 1.7.0.Beta1 @@ -40,7 +27,7 @@ junit junit - 4.12 + 4.13.1 test @@ -58,7 +45,7 @@ org.apache.maven.plugins maven-compiler-plugin - 3.8.1 + 3.14.1 1.8 1.8 diff --git a/mapstruct-updatemethods-1/src/main/java/org/mapstruct/example/dto/MammalDto.java b/mapstruct-updatemethods-1/src/main/java/org/mapstruct/example/dto/MammalDto.java index e2f8cb2f..6c13cc15 100644 --- a/mapstruct-updatemethods-1/src/main/java/org/mapstruct/example/dto/MammalDto.java +++ b/mapstruct-updatemethods-1/src/main/java/org/mapstruct/example/dto/MammalDto.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-updatemethods-1/src/main/java/org/mapstruct/example/dto/MammalEntity.java b/mapstruct-updatemethods-1/src/main/java/org/mapstruct/example/dto/MammalEntity.java index 3a6f1180..a35a79ab 100644 --- a/mapstruct-updatemethods-1/src/main/java/org/mapstruct/example/dto/MammalEntity.java +++ b/mapstruct-updatemethods-1/src/main/java/org/mapstruct/example/dto/MammalEntity.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.dto; diff --git a/mapstruct-updatemethods-1/src/main/java/org/mapstruct/example/mapper/SourceTargetMapper.java b/mapstruct-updatemethods-1/src/main/java/org/mapstruct/example/mapper/SourceTargetMapper.java index 89bc26e5..752c445f 100644 --- a/mapstruct-updatemethods-1/src/main/java/org/mapstruct/example/mapper/SourceTargetMapper.java +++ b/mapstruct-updatemethods-1/src/main/java/org/mapstruct/example/mapper/SourceTargetMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. +/* + * Copyright MapStruct Authors. * - * Licensed 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.mapper; diff --git a/mapstruct-updatemethods-1/src/test/java/org/mapstruct/example/SourceTargetMapperTest.java b/mapstruct-updatemethods-1/src/test/java/org/mapstruct/example/SourceTargetMapperTest.java index 56911aa6..811928a3 100644 --- a/mapstruct-updatemethods-1/src/test/java/org/mapstruct/example/SourceTargetMapperTest.java +++ b/mapstruct-updatemethods-1/src/test/java/org/mapstruct/example/SourceTargetMapperTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; diff --git a/mapstruct-updatemethods-1/src/test/java/org/mapstruct/example/SourceTargetTestMapperTest.java b/mapstruct-updatemethods-1/src/test/java/org/mapstruct/example/SourceTargetTestMapperTest.java index 52bb77de..4fbaec58 100644 --- a/mapstruct-updatemethods-1/src/test/java/org/mapstruct/example/SourceTargetTestMapperTest.java +++ b/mapstruct-updatemethods-1/src/test/java/org/mapstruct/example/SourceTargetTestMapperTest.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example; diff --git a/mapstruct-updatemethods-1/src/test/java/org/mapstruct/example/mapper/SourceTargetTestMapper.java b/mapstruct-updatemethods-1/src/test/java/org/mapstruct/example/mapper/SourceTargetTestMapper.java index 1f945cdb..1dbaa339 100644 --- a/mapstruct-updatemethods-1/src/test/java/org/mapstruct/example/mapper/SourceTargetTestMapper.java +++ b/mapstruct-updatemethods-1/src/test/java/org/mapstruct/example/mapper/SourceTargetTestMapper.java @@ -1,20 +1,7 @@ -/** - * Copyright 2012-2017 Gunnar Morling (http://www.gunnarmorling.de/) - * and/or other contributors as indicated by the @authors tag. See the - * copyright.txt file in the distribution for a full listing of all - * contributors. - * - * Licensed 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 +/* + * Copyright MapStruct Authors. * - * 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. + * Licensed under the Apache License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0 */ package org.mapstruct.example.mapper; diff --git a/mvnw b/mvnw index 41c0f0c2..bd8896bf 100755 --- a/mvnw +++ b/mvnw @@ -19,292 +19,277 @@ # ---------------------------------------------------------------------------- # ---------------------------------------------------------------------------- -# Maven Start Up Batch script -# -# Required ENV vars: -# ------------------ -# JAVA_HOME - location of a JDK home dir +# Apache Maven Wrapper startup batch script, version 3.3.4 # # Optional ENV vars # ----------------- -# M2_HOME - location of maven2's installed home dir -# MAVEN_OPTS - parameters passed to the Java VM when running Maven -# e.g. to debug Maven itself, use -# set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -# MAVEN_SKIP_RC - flag to disable loading of mavenrc files +# JAVA_HOME - location of a JDK home dir, required when download maven via java source +# MVNW_REPOURL - repo url base for downloading maven distribution +# MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +# MVNW_VERBOSE - true: enable verbose log; debug: trace the mvnw script; others: silence the output # ---------------------------------------------------------------------------- -if [ -z "$MAVEN_SKIP_RC" ] ; then - - if [ -f /etc/mavenrc ] ; then - . /etc/mavenrc - fi +set -euf +[ "${MVNW_VERBOSE-}" != debug ] || set -x - if [ -f "$HOME/.mavenrc" ] ; then - . "$HOME/.mavenrc" - fi +# OS specific support. +native_path() { printf %s\\n "$1"; } +case "$(uname)" in +CYGWIN* | MINGW*) + [ -z "${JAVA_HOME-}" ] || JAVA_HOME="$(cygpath --unix "$JAVA_HOME")" + native_path() { cygpath --path --windows "$1"; } + ;; +esac -fi +# set JAVACMD and JAVACCMD +set_java_home() { + # For Cygwin and MinGW, ensure paths are in Unix format before anything is touched + if [ -n "${JAVA_HOME-}" ]; then + if [ -x "$JAVA_HOME/jre/sh/java" ]; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACCMD="$JAVA_HOME/jre/sh/javac" + else + JAVACMD="$JAVA_HOME/bin/java" + JAVACCMD="$JAVA_HOME/bin/javac" -# OS specific support. $var _must_ be set to either true or false. -cygwin=false; -darwin=false; -mingw=false -case "`uname`" in - CYGWIN*) cygwin=true ;; - MINGW*) mingw=true;; - Darwin*) darwin=true - # Use /usr/libexec/java_home if available, otherwise fall back to /Library/Java/Home - # See https://developer.apple.com/library/mac/qa/qa1170/_index.html - if [ -z "$JAVA_HOME" ]; then - if [ -x "/usr/libexec/java_home" ]; then - export JAVA_HOME="`/usr/libexec/java_home`" - else - export JAVA_HOME="/Library/Java/Home" + if [ ! -x "$JAVACMD" ] || [ ! -x "$JAVACCMD" ]; then + echo "The JAVA_HOME environment variable is not defined correctly, so mvnw cannot run." >&2 + echo "JAVA_HOME is set to \"$JAVA_HOME\", but \"\$JAVA_HOME/bin/java\" or \"\$JAVA_HOME/bin/javac\" does not exist." >&2 + return 1 fi fi - ;; -esac - -if [ -z "$JAVA_HOME" ] ; then - if [ -r /etc/gentoo-release ] ; then - JAVA_HOME=`java-config --jre-home` + else + JAVACMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v java + )" || : + JAVACCMD="$( + 'set' +e + 'unset' -f command 2>/dev/null + 'command' -v javac + )" || : + + if [ ! -x "${JAVACMD-}" ] || [ ! -x "${JAVACCMD-}" ]; then + echo "The java/javac command does not exist in PATH nor is JAVA_HOME set, so mvnw cannot run." >&2 + return 1 + fi fi -fi - -if [ -z "$M2_HOME" ] ; then - ## resolve links - $0 may be a link to maven's home - PRG="$0" +} - # need this for relative symlinks - while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG="`dirname "$PRG"`/$link" - fi +# hash string like Java String::hashCode +hash_string() { + str="${1:-}" h=0 + while [ -n "$str" ]; do + char="${str%"${str#?}"}" + h=$(((h * 31 + $(LC_CTYPE=C printf %d "'$char")) % 4294967296)) + str="${str#?}" done + printf %x\\n $h +} - saveddir=`pwd` +verbose() { :; } +[ "${MVNW_VERBOSE-}" != true ] || verbose() { printf %s\\n "${1-}"; } - M2_HOME=`dirname "$PRG"`/.. +die() { + printf %s\\n "$1" >&2 + exit 1 +} - # make it fully qualified - M2_HOME=`cd "$M2_HOME" && pwd` +trim() { + # MWRAPPER-139: + # Trims trailing and leading whitespace, carriage returns, tabs, and linefeeds. + # Needed for removing poorly interpreted newline sequences when running in more + # exotic environments such as mingw bash on Windows. + printf "%s" "${1}" | tr -d '[:space:]' +} - cd "$saveddir" - # echo Using m2 at $M2_HOME -fi +scriptDir="$(dirname "$0")" +scriptName="$(basename "$0")" + +# parse distributionUrl and optional distributionSha256Sum, requires .mvn/wrapper/maven-wrapper.properties +while IFS="=" read -r key value; do + case "${key-}" in + distributionUrl) distributionUrl=$(trim "${value-}") ;; + distributionSha256Sum) distributionSha256Sum=$(trim "${value-}") ;; + esac +done <"$scriptDir/.mvn/wrapper/maven-wrapper.properties" +[ -n "${distributionUrl-}" ] || die "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" + +case "${distributionUrl##*/}" in +maven-mvnd-*bin.*) + MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ + case "${PROCESSOR_ARCHITECTURE-}${PROCESSOR_ARCHITEW6432-}:$(uname -a)" in + *AMD64:CYGWIN* | *AMD64:MINGW*) distributionPlatform=windows-amd64 ;; + :Darwin*x86_64) distributionPlatform=darwin-amd64 ;; + :Darwin*arm64) distributionPlatform=darwin-aarch64 ;; + :Linux*x86_64*) distributionPlatform=linux-amd64 ;; + *) + echo "Cannot detect native platform for mvnd on $(uname)-$(uname -m), use pure java version" >&2 + distributionPlatform=linux-amd64 + ;; + esac + distributionUrl="${distributionUrl%-bin.*}-$distributionPlatform.zip" + ;; +maven-mvnd-*) MVN_CMD=mvnd.sh _MVNW_REPO_PATTERN=/maven/mvnd/ ;; +*) MVN_CMD="mvn${scriptName#mvnw}" _MVNW_REPO_PATTERN=/org/apache/maven/ ;; +esac -# For Cygwin, ensure paths are in UNIX format before anything is touched -if $cygwin ; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --unix "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --unix "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --unix "$CLASSPATH"` -fi +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +[ -z "${MVNW_REPOURL-}" ] || distributionUrl="$MVNW_REPOURL$_MVNW_REPO_PATTERN${distributionUrl#*"$_MVNW_REPO_PATTERN"}" +distributionUrlName="${distributionUrl##*/}" +distributionUrlNameMain="${distributionUrlName%.*}" +distributionUrlNameMain="${distributionUrlNameMain%-bin}" +MAVEN_USER_HOME="${MAVEN_USER_HOME:-${HOME}/.m2}" +MAVEN_HOME="${MAVEN_USER_HOME}/wrapper/dists/${distributionUrlNameMain-}/$(hash_string "$distributionUrl")" + +exec_maven() { + unset MVNW_VERBOSE MVNW_USERNAME MVNW_PASSWORD MVNW_REPOURL || : + exec "$MAVEN_HOME/bin/$MVN_CMD" "$@" || die "cannot exec $MAVEN_HOME/bin/$MVN_CMD" +} -# For Mingw, ensure paths are in UNIX format before anything is touched -if $mingw ; then - [ -n "$M2_HOME" ] && - M2_HOME="`(cd "$M2_HOME"; pwd)`" - [ -n "$JAVA_HOME" ] && - JAVA_HOME="`(cd "$JAVA_HOME"; pwd)`" +if [ -d "$MAVEN_HOME" ]; then + verbose "found existing MAVEN_HOME at $MAVEN_HOME" + exec_maven "$@" fi -if [ -z "$JAVA_HOME" ]; then - javaExecutable="`which javac`" - if [ -n "$javaExecutable" ] && ! [ "`expr \"$javaExecutable\" : '\([^ ]*\)'`" = "no" ]; then - # readlink(1) is not available as standard on Solaris 10. - readLink=`which readlink` - if [ ! `expr "$readLink" : '\([^ ]*\)'` = "no" ]; then - if $darwin ; then - javaHome="`dirname \"$javaExecutable\"`" - javaExecutable="`cd \"$javaHome\" && pwd -P`/javac" - else - javaExecutable="`readlink -f \"$javaExecutable\"`" - fi - javaHome="`dirname \"$javaExecutable\"`" - javaHome=`expr "$javaHome" : '\(.*\)/bin'` - JAVA_HOME="$javaHome" - export JAVA_HOME - fi - fi -fi +case "${distributionUrl-}" in +*?-bin.zip | *?maven-mvnd-?*-?*.zip) ;; +*) die "distributionUrl is not valid, must match *-bin.zip or maven-mvnd-*.zip, but found '${distributionUrl-}'" ;; +esac -if [ -z "$JAVACMD" ] ; then - if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - else - JAVACMD="`which java`" - fi +# prepare tmp dir +if TMP_DOWNLOAD_DIR="$(mktemp -d)" && [ -d "$TMP_DOWNLOAD_DIR" ]; then + clean() { rm -rf -- "$TMP_DOWNLOAD_DIR"; } + trap clean HUP INT TERM EXIT +else + die "cannot create temp dir" fi -if [ ! -x "$JAVACMD" ] ; then - echo "Error: JAVA_HOME is not defined correctly." >&2 - echo " We cannot execute $JAVACMD" >&2 - exit 1 -fi +mkdir -p -- "${MAVEN_HOME%/*}" -if [ -z "$JAVA_HOME" ] ; then - echo "Warning: JAVA_HOME environment variable is not set." +# Download and Install Apache Maven +verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +verbose "Downloading from: $distributionUrl" +verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +# select .zip or .tar.gz +if ! command -v unzip >/dev/null; then + distributionUrl="${distributionUrl%.zip}.tar.gz" + distributionUrlName="${distributionUrl##*/}" fi -CLASSWORLDS_LAUNCHER=org.codehaus.plexus.classworlds.launcher.Launcher +# verbose opt +__MVNW_QUIET_WGET=--quiet __MVNW_QUIET_CURL=--silent __MVNW_QUIET_UNZIP=-q __MVNW_QUIET_TAR='' +[ "${MVNW_VERBOSE-}" != true ] || __MVNW_QUIET_WGET='' __MVNW_QUIET_CURL='' __MVNW_QUIET_UNZIP='' __MVNW_QUIET_TAR=v -# traverses directory structure from process work directory to filesystem root -# first directory with .mvn subdirectory is considered project base directory -find_maven_basedir() { +# normalize http auth +case "${MVNW_PASSWORD:+has-password}" in +'') MVNW_USERNAME='' MVNW_PASSWORD='' ;; +has-password) [ -n "${MVNW_USERNAME-}" ] || MVNW_USERNAME='' MVNW_PASSWORD='' ;; +esac - if [ -z "$1" ] - then - echo "Path not specified to find_maven_basedir" - return 1 - fi +if [ -z "${MVNW_USERNAME-}" ] && command -v wget >/dev/null; then + verbose "Found wget ... using wget" + wget ${__MVNW_QUIET_WGET:+"$__MVNW_QUIET_WGET"} "$distributionUrl" -O "$TMP_DOWNLOAD_DIR/$distributionUrlName" || die "wget: Failed to fetch $distributionUrl" +elif [ -z "${MVNW_USERNAME-}" ] && command -v curl >/dev/null; then + verbose "Found curl ... using curl" + curl ${__MVNW_QUIET_CURL:+"$__MVNW_QUIET_CURL"} -f -L -o "$TMP_DOWNLOAD_DIR/$distributionUrlName" "$distributionUrl" || die "curl: Failed to fetch $distributionUrl" +elif set_java_home; then + verbose "Falling back to use Java to download" + javaSource="$TMP_DOWNLOAD_DIR/Downloader.java" + targetZip="$TMP_DOWNLOAD_DIR/$distributionUrlName" + cat >"$javaSource" <<-END + public class Downloader extends java.net.Authenticator + { + protected java.net.PasswordAuthentication getPasswordAuthentication() + { + return new java.net.PasswordAuthentication( System.getenv( "MVNW_USERNAME" ), System.getenv( "MVNW_PASSWORD" ).toCharArray() ); + } + public static void main( String[] args ) throws Exception + { + setDefault( new Downloader() ); + java.nio.file.Files.copy( java.net.URI.create( args[0] ).toURL().openStream(), java.nio.file.Paths.get( args[1] ).toAbsolutePath().normalize() ); + } + } + END + # For Cygwin/MinGW, switch paths to Windows format before running javac and java + verbose " - Compiling Downloader.java ..." + "$(native_path "$JAVACCMD")" "$(native_path "$javaSource")" || die "Failed to compile Downloader.java" + verbose " - Running Downloader.java ..." + "$(native_path "$JAVACMD")" -cp "$(native_path "$TMP_DOWNLOAD_DIR")" Downloader "$distributionUrl" "$(native_path "$targetZip")" +fi - basedir="$1" - wdir="$1" - while [ "$wdir" != '/' ] ; do - if [ -d "$wdir"/.mvn ] ; then - basedir=$wdir - break +# If specified, validate the SHA-256 sum of the Maven distribution zip file +if [ -n "${distributionSha256Sum-}" ]; then + distributionSha256Result=false + if [ "$MVN_CMD" = mvnd.sh ]; then + echo "Checksum validation is not supported for maven-mvnd." >&2 + echo "Please disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + elif command -v sha256sum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | sha256sum -c - >/dev/null 2>&1; then + distributionSha256Result=true fi - # workaround for JBEAP-8937 (on Solaris 10/Sparc) - if [ -d "${wdir}" ]; then - wdir=`cd "$wdir/.."; pwd` + elif command -v shasum >/dev/null; then + if echo "$distributionSha256Sum $TMP_DOWNLOAD_DIR/$distributionUrlName" | shasum -a 256 -c >/dev/null 2>&1; then + distributionSha256Result=true fi - # end of workaround - done - echo "${basedir}" -} - -# concatenates all lines of a file -concat_lines() { - if [ -f "$1" ]; then - echo "$(tr -s '\n' ' ' < "$1")" + else + echo "Checksum validation was requested but neither 'sha256sum' or 'shasum' are available." >&2 + echo "Please install either command, or disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." >&2 + exit 1 + fi + if [ $distributionSha256Result = false ]; then + echo "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised." >&2 + echo "If you updated your Maven version, you need to update the specified distributionSha256Sum property." >&2 + exit 1 fi -} - -BASE_DIR=`find_maven_basedir "$(pwd)"` -if [ -z "$BASE_DIR" ]; then - exit 1; fi -########################################################################################## -# Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -# This allows using the maven wrapper in projects that prohibit checking in binary data. -########################################################################################## -if [ -r "$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found .mvn/wrapper/maven-wrapper.jar" - fi +# unzip and move +if command -v unzip >/dev/null; then + unzip ${__MVNW_QUIET_UNZIP:+"$__MVNW_QUIET_UNZIP"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -d "$TMP_DOWNLOAD_DIR" || die "failed to unzip" else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Couldn't find .mvn/wrapper/maven-wrapper.jar, downloading it ..." - fi - if [ -n "$MVNW_REPOURL" ]; then - jarUrl="$MVNW_REPOURL/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - else - jarUrl="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - fi - while IFS="=" read key value; do - case "$key" in (wrapperUrl) jarUrl="$value"; break ;; - esac - done < "$BASE_DIR/.mvn/wrapper/maven-wrapper.properties" - if [ "$MVNW_VERBOSE" = true ]; then - echo "Downloading from: $jarUrl" - fi - wrapperJarPath="$BASE_DIR/.mvn/wrapper/maven-wrapper.jar" - if $cygwin; then - wrapperJarPath=`cygpath --path --windows "$wrapperJarPath"` - fi + tar xzf${__MVNW_QUIET_TAR:+"$__MVNW_QUIET_TAR"} "$TMP_DOWNLOAD_DIR/$distributionUrlName" -C "$TMP_DOWNLOAD_DIR" || die "failed to untar" +fi - if command -v wget > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found wget ... using wget" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - wget "$jarUrl" -O "$wrapperJarPath" - else - wget --http-user=$MVNW_USERNAME --http-password=$MVNW_PASSWORD "$jarUrl" -O "$wrapperJarPath" - fi - elif command -v curl > /dev/null; then - if [ "$MVNW_VERBOSE" = true ]; then - echo "Found curl ... using curl" - fi - if [ -z "$MVNW_USERNAME" ] || [ -z "$MVNW_PASSWORD" ]; then - curl -o "$wrapperJarPath" "$jarUrl" -f - else - curl --user $MVNW_USERNAME:$MVNW_PASSWORD -o "$wrapperJarPath" "$jarUrl" -f - fi +# Find the actual extracted directory name (handles snapshots where filename != directory name) +actualDistributionDir="" - else - if [ "$MVNW_VERBOSE" = true ]; then - echo "Falling back to using Java to download" - fi - javaClass="$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.java" - # For Cygwin, switch paths to Windows format before running javac - if $cygwin; then - javaClass=`cygpath --path --windows "$javaClass"` - fi - if [ -e "$javaClass" ]; then - if [ ! -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Compiling MavenWrapperDownloader.java ..." - fi - # Compiling the Java class - ("$JAVA_HOME/bin/javac" "$javaClass") - fi - if [ -e "$BASE_DIR/.mvn/wrapper/MavenWrapperDownloader.class" ]; then - # Running the downloader - if [ "$MVNW_VERBOSE" = true ]; then - echo " - Running MavenWrapperDownloader.java ..." - fi - ("$JAVA_HOME/bin/java" -cp .mvn/wrapper MavenWrapperDownloader "$MAVEN_PROJECTBASEDIR") - fi - fi - fi +# First try the expected directory name (for regular distributions) +if [ -d "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain" ]; then + if [ -f "$TMP_DOWNLOAD_DIR/$distributionUrlNameMain/bin/$MVN_CMD" ]; then + actualDistributionDir="$distributionUrlNameMain" + fi fi -########################################################################################## -# End of extension -########################################################################################## -export MAVEN_PROJECTBASEDIR=${MAVEN_BASEDIR:-"$BASE_DIR"} -if [ "$MVNW_VERBOSE" = true ]; then - echo $MAVEN_PROJECTBASEDIR -fi -MAVEN_OPTS="$(concat_lines "$MAVEN_PROJECTBASEDIR/.mvn/jvm.config") $MAVEN_OPTS" - -# For Cygwin, switch paths to Windows format before running java -if $cygwin; then - [ -n "$M2_HOME" ] && - M2_HOME=`cygpath --path --windows "$M2_HOME"` - [ -n "$JAVA_HOME" ] && - JAVA_HOME=`cygpath --path --windows "$JAVA_HOME"` - [ -n "$CLASSPATH" ] && - CLASSPATH=`cygpath --path --windows "$CLASSPATH"` - [ -n "$MAVEN_PROJECTBASEDIR" ] && - MAVEN_PROJECTBASEDIR=`cygpath --path --windows "$MAVEN_PROJECTBASEDIR"` +# If not found, search for any directory with the Maven executable (for snapshots) +if [ -z "$actualDistributionDir" ]; then + # enable globbing to iterate over items + set +f + for dir in "$TMP_DOWNLOAD_DIR"/*; do + if [ -d "$dir" ]; then + if [ -f "$dir/bin/$MVN_CMD" ]; then + actualDistributionDir="$(basename "$dir")" + break + fi + fi + done + set -f fi -# Provide a "standardized" way to retrieve the CLI args that will -# work with both Windows and non-Windows executions. -MAVEN_CMD_LINE_ARGS="$MAVEN_CONFIG $@" -export MAVEN_CMD_LINE_ARGS +if [ -z "$actualDistributionDir" ]; then + verbose "Contents of $TMP_DOWNLOAD_DIR:" + verbose "$(ls -la "$TMP_DOWNLOAD_DIR")" + die "Could not find Maven distribution directory in extracted archive" +fi -WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain +verbose "Found extracted Maven distribution directory: $actualDistributionDir" +printf %s\\n "$distributionUrl" >"$TMP_DOWNLOAD_DIR/$actualDistributionDir/mvnw.url" +mv -- "$TMP_DOWNLOAD_DIR/$actualDistributionDir" "$MAVEN_HOME" || [ -d "$MAVEN_HOME" ] || die "fail to move MAVEN_HOME" -exec "$JAVACMD" \ - $MAVEN_OPTS \ - -classpath "$MAVEN_PROJECTBASEDIR/.mvn/wrapper/maven-wrapper.jar" \ - "-Dmaven.home=${M2_HOME}" "-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \ - ${WRAPPER_LAUNCHER} $MAVEN_CONFIG "$@" +clean || : +exec_maven "$@" diff --git a/mvnw.cmd b/mvnw.cmd index 86115719..92450f93 100644 --- a/mvnw.cmd +++ b/mvnw.cmd @@ -1,3 +1,4 @@ +<# : batch portion @REM ---------------------------------------------------------------------------- @REM Licensed to the Apache Software Foundation (ASF) under one @REM or more contributor license agreements. See the NOTICE file @@ -18,165 +19,171 @@ @REM ---------------------------------------------------------------------------- @REM ---------------------------------------------------------------------------- -@REM Maven Start Up Batch script -@REM -@REM Required ENV vars: -@REM JAVA_HOME - location of a JDK home dir +@REM Apache Maven Wrapper startup batch script, version 3.3.4 @REM @REM Optional ENV vars -@REM M2_HOME - location of maven2's installed home dir -@REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands -@REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a keystroke before ending -@REM MAVEN_OPTS - parameters passed to the Java VM when running Maven -@REM e.g. to debug Maven itself, use -@REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 -@REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files +@REM MVNW_REPOURL - repo url base for downloading maven distribution +@REM MVNW_USERNAME/MVNW_PASSWORD - user and password for downloading maven +@REM MVNW_VERBOSE - true: enable verbose log; others: silence the output @REM ---------------------------------------------------------------------------- -@REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' -@echo off -@REM set title of command window -title %0 -@REM enable echoing by setting MAVEN_BATCH_ECHO to 'on' -@if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% - -@REM set %HOME% to equivalent of $HOME -if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") - -@REM Execute a user defined script before this one -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre -@REM check for pre script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" -if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" -:skipRcPre - -@setlocal - -set ERROR_CODE=0 - -@REM To isolate internal variables from possible post scripts, we use another setlocal -@setlocal - -@REM ==== START VALIDATION ==== -if not "%JAVA_HOME%" == "" goto OkJHome - -echo. -echo Error: JAVA_HOME not found in your environment. >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -:OkJHome -if exist "%JAVA_HOME%\bin\java.exe" goto init - -echo. -echo Error: JAVA_HOME is set to an invalid directory. >&2 -echo JAVA_HOME = "%JAVA_HOME%" >&2 -echo Please set the JAVA_HOME variable in your environment to match the >&2 -echo location of your Java installation. >&2 -echo. -goto error - -@REM ==== END VALIDATION ==== - -:init - -@REM Find the project base dir, i.e. the directory that contains the folder ".mvn". -@REM Fallback to current working directory if not found. - -set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% -IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir - -set EXEC_DIR=%CD% -set WDIR=%EXEC_DIR% -:findBaseDir -IF EXIST "%WDIR%"\.mvn goto baseDirFound -cd .. -IF "%WDIR%"=="%CD%" goto baseDirNotFound -set WDIR=%CD% -goto findBaseDir - -:baseDirFound -set MAVEN_PROJECTBASEDIR=%WDIR% -cd "%EXEC_DIR%" -goto endDetectBaseDir - -:baseDirNotFound -set MAVEN_PROJECTBASEDIR=%EXEC_DIR% -cd "%EXEC_DIR%" - -:endDetectBaseDir - -IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig - -@setlocal EnableExtensions EnableDelayedExpansion -for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a -@endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% - -:endReadAdditionalConfig - -SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" -set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" -set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain - -set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - -FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO ( - IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B -) - -@REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central -@REM This allows using the maven wrapper in projects that prohibit checking in binary data. -if exist %WRAPPER_JAR% ( - if "%MVNW_VERBOSE%" == "true" ( - echo Found %WRAPPER_JAR% - ) -) else ( - if not "%MVNW_REPOURL%" == "" ( - SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar" - ) - if "%MVNW_VERBOSE%" == "true" ( - echo Couldn't find %WRAPPER_JAR%, downloading it ... - echo Downloading from: %DOWNLOAD_URL% - ) - - powershell -Command "&{"^ - "$webclient = new-object System.Net.WebClient;"^ - "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^ - "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^ - "}"^ - "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^ - "}" - if "%MVNW_VERBOSE%" == "true" ( - echo Finished downloading %WRAPPER_JAR% - ) +@IF "%__MVNW_ARG0_NAME__%"=="" (SET __MVNW_ARG0_NAME__=%~nx0) +@SET __MVNW_CMD__= +@SET __MVNW_ERROR__= +@SET __MVNW_PSMODULEP_SAVE=%PSModulePath% +@SET PSModulePath= +@FOR /F "usebackq tokens=1* delims==" %%A IN (`powershell -noprofile "& {$scriptDir='%~dp0'; $script='%__MVNW_ARG0_NAME__%'; icm -ScriptBlock ([Scriptblock]::Create((Get-Content -Raw '%~f0'))) -NoNewScope}"`) DO @( + IF "%%A"=="MVN_CMD" (set __MVNW_CMD__=%%B) ELSE IF "%%B"=="" (echo %%A) ELSE (echo %%A=%%B) ) -@REM End of extension - -@REM Provide a "standardized" way to retrieve the CLI args that will -@REM work with both Windows and non-Windows executions. -set MAVEN_CMD_LINE_ARGS=%* - -%MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* -if ERRORLEVEL 1 goto error -goto end - -:error -set ERROR_CODE=1 - -:end -@endlocal & set ERROR_CODE=%ERROR_CODE% - -if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost -@REM check for post script, once with legacy .bat ending and once with .cmd ending -if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" -if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" -:skipRcPost - -@REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' -if "%MAVEN_BATCH_PAUSE%" == "on" pause - -if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% - -exit /B %ERROR_CODE% +@SET PSModulePath=%__MVNW_PSMODULEP_SAVE% +@SET __MVNW_PSMODULEP_SAVE= +@SET __MVNW_ARG0_NAME__= +@SET MVNW_USERNAME= +@SET MVNW_PASSWORD= +@IF NOT "%__MVNW_CMD__%"=="" ("%__MVNW_CMD__%" %*) +@echo Cannot start maven from wrapper >&2 && exit /b 1 +@GOTO :EOF +: end batch / begin powershell #> + +$ErrorActionPreference = "Stop" +if ($env:MVNW_VERBOSE -eq "true") { + $VerbosePreference = "Continue" +} + +# calculate distributionUrl, requires .mvn/wrapper/maven-wrapper.properties +$distributionUrl = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionUrl +if (!$distributionUrl) { + Write-Error "cannot read distributionUrl property in $scriptDir/.mvn/wrapper/maven-wrapper.properties" +} + +switch -wildcard -casesensitive ( $($distributionUrl -replace '^.*/','') ) { + "maven-mvnd-*" { + $USE_MVND = $true + $distributionUrl = $distributionUrl -replace '-bin\.[^.]*$',"-windows-amd64.zip" + $MVN_CMD = "mvnd.cmd" + break + } + default { + $USE_MVND = $false + $MVN_CMD = $script -replace '^mvnw','mvn' + break + } +} + +# apply MVNW_REPOURL and calculate MAVEN_HOME +# maven home pattern: ~/.m2/wrapper/dists/{apache-maven-,maven-mvnd--}/ +if ($env:MVNW_REPOURL) { + $MVNW_REPO_PATTERN = if ($USE_MVND -eq $False) { "/org/apache/maven/" } else { "/maven/mvnd/" } + $distributionUrl = "$env:MVNW_REPOURL$MVNW_REPO_PATTERN$($distributionUrl -replace "^.*$MVNW_REPO_PATTERN",'')" +} +$distributionUrlName = $distributionUrl -replace '^.*/','' +$distributionUrlNameMain = $distributionUrlName -replace '\.[^.]*$','' -replace '-bin$','' + +$MAVEN_M2_PATH = "$HOME/.m2" +if ($env:MAVEN_USER_HOME) { + $MAVEN_M2_PATH = "$env:MAVEN_USER_HOME" +} + +if (-not (Test-Path -Path $MAVEN_M2_PATH)) { + New-Item -Path $MAVEN_M2_PATH -ItemType Directory | Out-Null +} + +$MAVEN_WRAPPER_DISTS = $null +if ((Get-Item $MAVEN_M2_PATH).Target[0] -eq $null) { + $MAVEN_WRAPPER_DISTS = "$MAVEN_M2_PATH/wrapper/dists" +} else { + $MAVEN_WRAPPER_DISTS = (Get-Item $MAVEN_M2_PATH).Target[0] + "/wrapper/dists" +} + +$MAVEN_HOME_PARENT = "$MAVEN_WRAPPER_DISTS/$distributionUrlNameMain" +$MAVEN_HOME_NAME = ([System.Security.Cryptography.SHA256]::Create().ComputeHash([byte[]][char[]]$distributionUrl) | ForEach-Object {$_.ToString("x2")}) -join '' +$MAVEN_HOME = "$MAVEN_HOME_PARENT/$MAVEN_HOME_NAME" + +if (Test-Path -Path "$MAVEN_HOME" -PathType Container) { + Write-Verbose "found existing MAVEN_HOME at $MAVEN_HOME" + Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" + exit $? +} + +if (! $distributionUrlNameMain -or ($distributionUrlName -eq $distributionUrlNameMain)) { + Write-Error "distributionUrl is not valid, must end with *-bin.zip, but found $distributionUrl" +} + +# prepare tmp dir +$TMP_DOWNLOAD_DIR_HOLDER = New-TemporaryFile +$TMP_DOWNLOAD_DIR = New-Item -Itemtype Directory -Path "$TMP_DOWNLOAD_DIR_HOLDER.dir" +$TMP_DOWNLOAD_DIR_HOLDER.Delete() | Out-Null +trap { + if ($TMP_DOWNLOAD_DIR.Exists) { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } + } +} + +New-Item -Itemtype Directory -Path "$MAVEN_HOME_PARENT" -Force | Out-Null + +# Download and Install Apache Maven +Write-Verbose "Couldn't find MAVEN_HOME, downloading and installing it ..." +Write-Verbose "Downloading from: $distributionUrl" +Write-Verbose "Downloading to: $TMP_DOWNLOAD_DIR/$distributionUrlName" + +$webclient = New-Object System.Net.WebClient +if ($env:MVNW_USERNAME -and $env:MVNW_PASSWORD) { + $webclient.Credentials = New-Object System.Net.NetworkCredential($env:MVNW_USERNAME, $env:MVNW_PASSWORD) +} +[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 +$webclient.DownloadFile($distributionUrl, "$TMP_DOWNLOAD_DIR/$distributionUrlName") | Out-Null + +# If specified, validate the SHA-256 sum of the Maven distribution zip file +$distributionSha256Sum = (Get-Content -Raw "$scriptDir/.mvn/wrapper/maven-wrapper.properties" | ConvertFrom-StringData).distributionSha256Sum +if ($distributionSha256Sum) { + if ($USE_MVND) { + Write-Error "Checksum validation is not supported for maven-mvnd. `nPlease disable validation by removing 'distributionSha256Sum' from your maven-wrapper.properties." + } + Import-Module $PSHOME\Modules\Microsoft.PowerShell.Utility -Function Get-FileHash + if ((Get-FileHash "$TMP_DOWNLOAD_DIR/$distributionUrlName" -Algorithm SHA256).Hash.ToLower() -ne $distributionSha256Sum) { + Write-Error "Error: Failed to validate Maven distribution SHA-256, your Maven distribution might be compromised. If you updated your Maven version, you need to update the specified distributionSha256Sum property." + } +} + +# unzip and move +Expand-Archive "$TMP_DOWNLOAD_DIR/$distributionUrlName" -DestinationPath "$TMP_DOWNLOAD_DIR" | Out-Null + +# Find the actual extracted directory name (handles snapshots where filename != directory name) +$actualDistributionDir = "" + +# First try the expected directory name (for regular distributions) +$expectedPath = Join-Path "$TMP_DOWNLOAD_DIR" "$distributionUrlNameMain" +$expectedMvnPath = Join-Path "$expectedPath" "bin/$MVN_CMD" +if ((Test-Path -Path $expectedPath -PathType Container) -and (Test-Path -Path $expectedMvnPath -PathType Leaf)) { + $actualDistributionDir = $distributionUrlNameMain +} + +# If not found, search for any directory with the Maven executable (for snapshots) +if (!$actualDistributionDir) { + Get-ChildItem -Path "$TMP_DOWNLOAD_DIR" -Directory | ForEach-Object { + $testPath = Join-Path $_.FullName "bin/$MVN_CMD" + if (Test-Path -Path $testPath -PathType Leaf) { + $actualDistributionDir = $_.Name + } + } +} + +if (!$actualDistributionDir) { + Write-Error "Could not find Maven distribution directory in extracted archive" +} + +Write-Verbose "Found extracted Maven distribution directory: $actualDistributionDir" +Rename-Item -Path "$TMP_DOWNLOAD_DIR/$actualDistributionDir" -NewName $MAVEN_HOME_NAME | Out-Null +try { + Move-Item -Path "$TMP_DOWNLOAD_DIR/$MAVEN_HOME_NAME" -Destination $MAVEN_HOME_PARENT | Out-Null +} catch { + if (! (Test-Path -Path "$MAVEN_HOME" -PathType Container)) { + Write-Error "fail to move MAVEN_HOME" + } +} finally { + try { Remove-Item $TMP_DOWNLOAD_DIR -Recurse -Force | Out-Null } + catch { Write-Warning "Cannot remove $TMP_DOWNLOAD_DIR" } +} + +Write-Output "MVN_CMD=$MAVEN_HOME/bin/$MVN_CMD" diff --git a/pom.xml b/pom.xml index 3d256eeb..7014467d 100644 --- a/pom.xml +++ b/pom.xml @@ -1,22 +1,9 @@ mapstruct-spi-accessor-naming mapstruct-protobuf3 mapstruct-updatemethods-1 - mapstruct-kotlin mapstruct-jpa-child-parent mapstruct-lookup-entity-with-id mapstruct-metadata-with-annotations mapstruct-suppress-unmapped mapstruct-clone mapstruct-mapper-repo + mapstruct-kotlin diff --git a/settings.gradle b/settings.gradle index d8110679..d23b4a19 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,6 +1,9 @@ rootProject.name = 'mapstruct-examples' +if (JavaVersion.current() <= JavaVersion.VERSION_17) { includeBuild 'mapstruct-kotlin-gradle' +} includeBuild 'mapstruct-lombok' includeBuild 'mapstruct-on-gradle' includeBuild 'mapstruct-on-gradle-protobuf3' +includeBuild 'mapstruct-on-gradle-testcp-with-lombok'