Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/validate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
version: [11, 17]
version: [11, 17, 21, 25]

steps:
- uses: actions/checkout@v6
Expand Down
52 changes: 40 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>
<maven.deploy.skip>false</maven.deploy.skip>
<project.build.outputTimestamp>0</project.build.outputTimestamp>

<slf4j.version>2.0.13</slf4j.version>
<javaparser.version>3.26.1</javaparser.version>
Expand Down Expand Up @@ -69,7 +70,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<version>3.15.0</version>
<configuration>
<annotationProcessorPaths>
<path>
Expand All @@ -88,7 +89,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M7</version>
<version>3.5.6</version>
<configuration>
<statelessTestsetReporter implementation="org.apache.maven.plugin.surefire.extensions.junit5.JUnit5Xml30StatelessReporter">
<disable>false</disable>
Expand All @@ -113,21 +114,29 @@
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.3.2</version>
<version>3.5.1</version>
</plugin>
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.2.0</version>
<version>3.5.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<version>3.6.2</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<version>3.6.0</version>
<version>3.15.2</version>
<configuration>
<requiredMavenVersion>3.9</requiredMavenVersion>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.sisu</groupId>
<artifactId>sisu-maven-plugin</artifactId>
<version>1.0.0</version>
</plugin>
<plugin>
<groupId>io.github.mavenplugins</groupId>
Expand All @@ -137,30 +146,49 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.4</version>
<version>3.2.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<version>3.3.0</version>
<version>3.4.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.6.3</version>
<version>3.12.0</version>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.maven</groupId>
<artifactId>maven-archiver</artifactId>
<version>3.6.6</version>
</dependency>
</dependencies>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.5.0</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.5.0</version>
</plugin>


<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.16.2</version>
<version>2.21.0</version>
<configuration>
<processDependencyManagementTransitive>false</processDependencyManagementTransitive>
<ruleSet>
Expand All @@ -171,7 +199,7 @@
</ignoreVersion>
<ignoreVersion>
<type>regex</type>
<version>.+-(alpha|beta|rc|M)[0-9]*</version>
<version>.+[-.](alpha|beta|rc|RC|M)[0-9]*</version>
</ignoreVersion>
</ignoreVersions>
<rules>
Expand Down Expand Up @@ -382,7 +410,7 @@
<dependency>
<groupId>io.github.unknow0.maven</groupId>
<artifactId>unknow-maven-codegen</artifactId>
<version>0.02</version>
<version>0.2.0</version>
</dependency>
<dependency>
<groupId>io.github.unknow0.model</groupId>
Expand Down
6 changes: 4 additions & 2 deletions unknow-server-maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-plugin-plugin</artifactId>
<configuration>
<mojoDependencies />
<mojoDependencies>
<mojoDependencie>io.github.unknow0.maven:unknow-maven-codegen</mojoDependencie>
</mojoDependencies>
<skipErrorNoDescriptorsFound>true</skipErrorNoDescriptorsFound>
<goalPrefix>unknow-server</goalPrefix>
</configuration>
</plugin>
<plugin>
<groupId>org.eclipse.sisu</groupId>
<artifactId>sisu-maven-plugin</artifactId>
<version>0.3.3</version>
<executions>
<execution>
<id>generate-index</id>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.github.javaparser.ast.stmt.ReturnStmt;

import jakarta.xml.bind.annotation.XmlRootElement;
import unknow.maven.codegen.AbstractCodeGenMojo;
import unknow.maven.codegen.CodeGenUtils;
import unknow.maven.codegen.TypeFactory;
import unknow.model.api.AnnotationModel;
Expand All @@ -58,7 +59,6 @@
import unknow.server.jaxb.handler.ShortHandler;
import unknow.server.jaxb.handler.StringHandler;
import unknow.server.jaxb.handler.ZonedDateTimeHandler;
import unknow.server.maven.AbstractGeneratorMojo;
import unknow.server.maven.jaxb.builder.HandlerBuilder;
import unknow.server.maven.jaxb.model.XmlCollection;
import unknow.server.maven.jaxb.model.XmlLoader;
Expand All @@ -68,7 +68,7 @@
* @author unknow
*/
@Mojo(defaultPhase = LifecyclePhase.GENERATE_SOURCES, name = "jaxb-generator", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
public class JaxbGeneratorMojo extends AbstractGeneratorMojo {
public class JaxbGeneratorMojo extends AbstractCodeGenMojo {
private static final HandlerBuilder HANDLER = new HandlerBuilder();

private final Map<XmlType, String> handlers = new HashMap<>();
Expand Down Expand Up @@ -98,8 +98,7 @@ public JaxbGeneratorMojo() {
}

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
init(session, mojo, repository, codegen);
protected void doexecute() throws MojoExecutionException, MojoFailureException {
processSrc(type -> {
if (type.annotation(jakarta.xml.bind.annotation.XmlType.class).isPresent())
xmlLoader.add(type);
Expand Down Expand Up @@ -147,7 +146,7 @@ private void writeXmlLoader() throws MojoExecutionException {
ClassOrInterfaceDeclaration cl = cu.addClass("XmlLoader", CodeGenUtils.PUBLIC).addImplementedType(types.getClass(XmlHandlerLoader.class));

cl.addMethod("contextPath", CodeGenUtils.PUBLIC).addMarkerAnnotation(Override.class).setType(types.getClass(String.class)).createBody()
.addStatement(new ReturnStmt(CodeGenUtils.text(codegen.packageName)));
.addStatement(new ReturnStmt(CodeGenUtils.text(codegen.getPackageName())));

NodeList<Expression> list = new NodeList<>();
for (Entry<XmlType, String> e : handlers.entrySet()) {
Expand All @@ -162,7 +161,7 @@ private void writeXmlLoader() throws MojoExecutionException {

writer.write(cu);

Path path = Paths.get(codegen.resources, "META-INF", "services", XmlHandlerLoader.class.getName());
Path path = Paths.get(codegen.getResources(), "META-INF", "services", XmlHandlerLoader.class.getName());
try {
Files.createDirectories(path.getParent());
try (BufferedWriter w = Files.newBufferedWriter(path)) {
Expand All @@ -175,11 +174,11 @@ private void writeXmlLoader() throws MojoExecutionException {
}

private void generateGraalVmResources() throws MojoFailureException {
if (!codegen.graalvm)
if (!codegen.isGraalvm())
return;

try {
Path path = Paths.get(codegen.resources + "/META-INF/native-image/" + uniquePath + "/resource-config.json");
Path path = Paths.get(codegen.getResources() + "/META-INF/native-image/" + uniquePath + "/resource-config.json");
Files.createDirectories(path.getParent());
try (BufferedWriter w = Files.newBufferedWriter(path)) {
w.write("{\"resources\":{\"includes\":[");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,20 @@
import jakarta.ws.rs.ext.ParamConverter;
import jakarta.ws.rs.ext.ParamConverterProvider;
import jakarta.ws.rs.ext.RuntimeDelegate;
import unknow.maven.codegen.AbstractCodeGenMojo;
import unknow.maven.codegen.CodeGenUtils;
import unknow.maven.codegen.TypeFactory;
import unknow.model.api.ClassModel;
import unknow.model.api.TypeModel;
import unknow.server.http.jaxrs.JaxrsContext;
import unknow.server.http.jaxrs.JaxrsRuntime;
import unknow.server.http.jaxrs.protostuff.ProtostuffSchema;
import unknow.server.maven.AbstractGeneratorMojo;

/**
* @author unknow
*/
@Mojo(defaultPhase = LifecyclePhase.GENERATE_SOURCES, name = "jaxrs-generator", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
public class JaxrsMojo extends AbstractGeneratorMojo {
public class JaxrsMojo extends AbstractCodeGenMojo {
private static final String VALUE = "value";

private JaxrsModel model;
Expand All @@ -94,8 +94,7 @@ public class JaxrsMojo extends AbstractGeneratorMojo {
private MediaTypesBuilder mt;

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
init(session, mojo, repository, codegen);
protected void doexecute() throws MojoExecutionException, MojoFailureException {
if (basePath.endsWith("/"))
basePath = basePath.substring(0, basePath.length() - 1);
model = new JaxrsModel(loader, classLoader, basePath);
Expand Down Expand Up @@ -124,7 +123,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
for (Entry<String, List<JaxrsMapping>> e : map.entrySet())
writer.write(new JaxRsServletBuilder(newCu(), existingClass, e.getKey(), e.getValue(), beans, mt).build());

new OpenApiBuilder().build(openapi.getSpec(project), model, codegen.resources + basePath + "/openapi.json");
new OpenApiBuilder().build(openapi.getSpec(project), model, codegen.getResources() + basePath + "/openapi.json");
beans.save(writer);
mt.save(writer);

Expand All @@ -136,7 +135,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
*/

private void generateInitalizer() throws IOException, MojoExecutionException {
Path path = Paths.get(codegen.resources, "META-INF", "services", ServletContainerInitializer.class.getName());
Path path = Paths.get(codegen.getResources(), "META-INF", "services", ServletContainerInitializer.class.getName());
Files.createDirectories(path.getParent());
try (Writer w = Files.newBufferedWriter(path, StandardCharsets.UTF_8)) {
w.append(fullName("JaxrsInit")).write('\n');
Expand Down Expand Up @@ -265,11 +264,11 @@ private void generateImplicitConverter(ClassOrInterfaceDeclaration clazz, String
}

private void generateGraalvmResources() throws MojoFailureException {
if (!codegen.graalvm)
if (!codegen.isGraalvm())
return;

try {
Path path = Paths.get(codegen.resources + "/META-INF/native-image/" + uniquePath + "/resource-config.json");
Path path = Paths.get(codegen.getResources() + "/META-INF/native-image/" + uniquePath + "/resource-config.json");
Files.createDirectories(path.getParent());
try (BufferedWriter w = Files.newBufferedWriter(path)) {
w.write("{\"resources\":{\"includes\":[");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@
import com.github.javaparser.ast.CompilationUnit;

import jakarta.jws.WebService;
import unknow.maven.codegen.AbstractCodeGenMojo;
import unknow.maven.codegen.TypeFactory;
import unknow.model.api.AnnotationModel;
import unknow.server.maven.AbstractGeneratorMojo;
import unknow.server.maven.jaxb.model.XmlLoader;
import unknow.server.maven.jaxws.binding.Service;

/**
* @author unknow
*/
@Mojo(defaultPhase = LifecyclePhase.GENERATE_SOURCES, name = "jaxws-generator", requiresDependencyResolution = ResolutionScope.COMPILE_PLUS_RUNTIME, requiresDependencyCollection = ResolutionScope.COMPILE_PLUS_RUNTIME)
public class JaxwsGeneratorMojo extends AbstractGeneratorMojo {
public class JaxwsGeneratorMojo extends AbstractCodeGenMojo {
private static final Logger logger = LoggerFactory.getLogger(JaxwsGeneratorMojo.class);
private static final XMLOutputFactory f = XMLOutputFactory.newInstance();

Expand All @@ -55,9 +55,7 @@ public class JaxwsGeneratorMojo extends AbstractGeneratorMojo {
private final XmlLoader xmlLoader = new XmlLoader();

@Override
public void execute() throws MojoExecutionException, MojoFailureException {
init(session, mojo, repository, codegen);

protected void doexecute() throws MojoExecutionException, MojoFailureException {
if (!basePath.endsWith("/"))
basePath += "/";

Expand All @@ -80,7 +78,7 @@ public void execute() throws MojoExecutionException, MojoFailureException {
Service service = Service.build(t.asClass(), basePath, loader, xmlLoader);

String n = "generated/" + uniquePath + "/" + service.name + ".wsdl";
Path path = Paths.get(codegen.resources, n);
Path path = Paths.get(codegen.getResources(), n);
Files.createDirectories(path.getParent());
try (BufferedWriter w = Files.newBufferedWriter(path)) {
new WsdlBuilder(service, publishUrl).write(f.createXMLStreamWriter(w));
Expand All @@ -93,9 +91,9 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}
});

if (codegen.graalvm && !wsdl.isEmpty()) {
if (codegen.isGraalvm() && !wsdl.isEmpty()) {
try {
Path path = Paths.get(codegen.resources + "/META-INF/native-image/" + uniquePath + "/resource-config.json");
Path path = Paths.get(codegen.getResources() + "/META-INF/native-image/" + uniquePath + "/resource-config.json");
Files.createDirectories(path.getParent());
try (BufferedWriter w = Files.newBufferedWriter(path)) {
w.write("{\"resources\":{\"includes\":[");
Expand Down
Loading