[JAVA] Switch from slim3-gen to slim3-gen-jsr269

Motivation to switch to slim3-gen-jsr269

From Java8, apt used in slim3-gen is obsolete /view_bug.do?bug_id=7041249).

Edited part

pom.xml


#Artif related
slim3-gen -> slim3-gen-jsr269

#Switch apt artifacts
org.codehaus.mojo apt-maven-plugin -> com.mysema.maven apt-maven-plugin

#Delete apt related description

Source output destination

By default, the sources are output to target / generated-sources / annotations. To change this to $ {generated.src}, set as follows.

pom.xml


  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.7.0</version>
        <configuration>
          <!-- Need to disable default annotation processing since apt-maven-plugin takes over -->
          <compilerArgument>-proc:none</compilerArgument>
        </configuration>
      </plugin>
      <plugin>
        <groupId>com.mysema.maven</groupId>
        <artifactId>apt-maven-plugin</artifactId>
        <version>1.1.3</version>
        <executions>
          <execution>
            <goals>
              <goal>process</goal>
            </goals>
            <configuration>
              <outputDirectory>${generated.src}</outputDirectory>
              <processors>
                <processor>org.slim3.gen.processor.ModelProcessor</processor>
              </processors>
            </configuration>
          </execution>
        </executions>
      </plugin>
      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>build-helper-maven-plugin</artifactId>
        <version>3.0.0</version>
        <executions>
          <execution>
            <!-- Need to ensure the generated source folder is added to the project classpath -->
            <id>add-source</id>
            <phase>generate-sources</phase>
            <goals>
              <goal>add-source</goal>
            </goals>
            <configuration>
              <sources>
                <source>${generated.src}</source>
              </sources>
            </configuration>
          </execution>
        </executions>
      </plugin>
    </plugins>
  </build>

Reference material

https://github.com/redhat-developer/vscode-java/wiki/Annotation-Processing-support-for-Maven-projects

Recommended Posts

Switch from slim3-gen to slim3-gen-jsr269
Switch from JSP + JSTL to Thymeleaf
Switch from Eclipse to VS Code
[Java] How to switch from open jdk to oracle jdk
Changes from Java 8 to Java 11
Sum from Java_1 to 100
Migrate from JUnit 4 to JUnit 5
Swipe to switch screens
From Java to Ruby !!
Moved from iBATIS to MyBatis3
Try Spring Boot from 0 to 100.
Moving from AWS to PaizaCloud
New features from Java7 to Java8
Migrating from vargrant to docker
Connect from Java to PostgreSQL
Convert from ○ months to ○ years ○ months
Rewriting from applet to application
Change from SQLite3 to PostgreSQL
From Ineffective Java to Effective Java
How to migrate from JUnit4 to JUnit5
How to push from Tarminal to GitHub
Dynamically switch the database to connect to
protocol buffeer migration from 2.x to 3.x
[Note] Download from S3, upload to S3
Stop resending from client to server
Ubuntu Desktop upgrade from 18.0.4 (?) To 20.04.1 (focal)
Upgrade from MYSQL5.7 to 8.0 on CentOS 6.7
Migrate from on-premise Pukiwiki to esa.io \ (⁰⊖⁰) /
From introduction to use of ActiveHash
Java to be involved from today
From Java to VB.NET-Writing Contrast Memo-
Introduction to Ruby (from other languages)
To switch JVM for each project
Java, interface to start from beginner
Change DB from SQLite to MySQL
Notes on migrating from CircleCI 1.0 to 2.0
Addicted to project imports from GitHub
Upgrade spring boot from 1.5 series to 2.0 series
We aim to update daily from 2021
From introduction to usage of byebug
The road from JavaScript to Java
Memorandum Poem (updated from time to time)
[Java] Conversion from array to List
Update MySQL from 5.7 to 8.0 with Docker
How to change from HTML to Haml