I am working on a spring boot maven project in Eclipse IDE. And here is my pom.xml.
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<artifactId>spring-swagger-codegen-api-client</artifactId>
<name>spring-swagger-codegen-api-client</name>
<packaging>jar</packaging>
<url>https://github.com/swagger-api/swagger-codegen</url>
<description>Swagger Java</description>
...
...ommited for brevity
...
<build>
<plugins>
<plugin>
<groupId>io.swagger</groupId>
<artifactId>swagger-codegen-maven-plugin</artifactId>
<version>2.3.1</version>
<executions>
<execution>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<inputSpec>${project.basedir}/src/main/resources/customer-data-v2.json</inputSpec>
<language>java</language>
<configOptions>
<sourceFolder>swagger</sourceFolder>
</configOptions>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
When I compile the project using mvn compile
it executes swagger code gen plugin, it uses customer json schema to generate Model classes and then outputs all the generated classes to swagger folder under target folder.
I know that I can keep all the generated classes under target folder itself as maven executes swagger plugin before compiling the actual source code. So right now there is no issue with it.
But all the generated classes are Model classes which are used for processing request and response data.Currently there is no issue in doing so, but in future we might add additional functionality which might require updates to generated model classes and may be difficult to update them from target folder.
My main question is should I move all the generated pojo classes to something like src/main/org/**/* folder or keep the model classes inside target folder itself? What is the better approach including other alternatives?