Skip to content

Commit

Permalink
eclipse-ee4j#656: Perform refresh in Eclipse after M2E execution of j…
Browse files Browse the repository at this point in the history
…axws-maven-plugin

Signed-off-by: Lukas Jungmann <lukas.jungmann@oracle.com>
  • Loading branch information
lukasj committed Oct 17, 2023
1 parent f875e19 commit fef9113
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@
<listitem>
<para>Replaces the last resort fallback to Java SE provided runtime by the fallback to the current WS runtime</para>
</listitem>
<listitem><para>
<link xlink:href="https://github.com/eclipse-ee4j/metro-jax-ws/issues/656">#656</link>: Perform refresh in Eclipse after M2E execution of jaxws-maven-plugin
</para></listitem>
</itemizedlist>
</listitem>

Expand Down
10 changes: 10 additions & 0 deletions jaxws-ri/extras/jaxws-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@
<artifactId>maven-resolver-util</artifactId>
<version>1.9.16</version>
</dependency>
<!-- m2e -->
<dependency>
<groupId>org.sonatype.plexus</groupId>
<artifactId>plexus-build-api</artifactId>
<version>0.0.7</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand All @@ -142,6 +148,10 @@
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-utils</artifactId>
</dependency>
<dependency>
<groupId>org.sonatype.plexus</groupId>
<artifactId>plexus-build-api</artifactId>
</dependency>
<dependency>
<groupId>org.codehaus.plexus</groupId>
<artifactId>plexus-xml</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright 2006 Codehaus
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -56,6 +56,7 @@
import org.eclipse.aether.resolution.DependencyResolutionException;
import org.eclipse.aether.resolution.DependencyResult;
import org.eclipse.aether.util.graph.visitor.PreorderNodeListGenerator;
import org.sonatype.plexus.build.incremental.BuildContext;

/**
*
Expand Down Expand Up @@ -173,6 +174,9 @@ abstract class AbstractJaxwsMojo extends AbstractMojo {
@Parameter(defaultValue = "${plugin}", readonly = true)
protected PluginDescriptor pluginDescriptor;

@Component
protected BuildContext buildContext;

private static final Logger logger = Logger.getLogger(AbstractJaxwsMojo.class.getName());
private static final List<String> METRO_30 = new ArrayList<>();

Expand Down Expand Up @@ -366,7 +370,7 @@ protected void exec(List<String> args) throws MojoExecutionException {
}
String fullCommand = cmd.toString();
if (isWindows() && 8191 <= fullCommand.length()) {
getLog().warn("Length of the command is limitted to 8191 characters but it has "
getLog().warn("Length of the command is limited to 8191 characters but it has "
+ fullCommand.length() + " characters.");
getLog().warn(fullCommand);
} else {
Expand All @@ -375,6 +379,7 @@ protected void exec(List<String> args) throws MojoExecutionException {
if (CommandLineUtils.executeCommandLine(cmd, sc, sc) != 0) {
throw new MojoExecutionException("Mojo failed - check output");
}
buildContext.refresh(getSourceDestDir());
} catch (DependencyResolutionException | CommandLineException dre) {
throw new MojoExecutionException(dre.getMessage(), dre);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2012, 2022 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2023 Oracle and/or its affiliates. All rights reserved.
* Copyright 2006 Guillaume Nodet
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -139,15 +139,18 @@ public void execute() throws MojoExecutionException, MojoFailureException {
}

protected void processSei(String sei) throws MojoExecutionException {
getLog().info("Processing: " + sei);
List<String> args = getWsGenArgs(sei, true);
getLog().info("jaxws:wsgen args: " + args);
exec(args);
if (metadata != null) {
try {
FileUtils.copyFileToDirectory(metadata, getClassesDir());
} catch (IOException ioe) {
throw new MojoExecutionException(ioe.getMessage(), ioe);
if (buildContext.hasDelta(new File(getClassesDir(), sei.replace('.', '/') + ".class"))
|| (metadata != null && buildContext.hasDelta(metadata))) {
getLog().info("Processing: " + sei);
List<String> args = getWsGenArgs(sei, true);
getLog().info("jaxws:wsgen args: " + args);
exec(args);
if (metadata != null) {
try {
FileUtils.copyFileToDirectory(metadata, getClassesDir());
} catch (IOException ioe) {
throw new MojoExecutionException(ioe.getMessage(), ioe);
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ public void execute() throws MojoExecutionException, MojoFailureException {
throw new MojoExecutionException("Failed to execute wsgen", ex);
}
}

}

private void attachWsdl() throws IOException {
Expand Down Expand Up @@ -137,6 +136,7 @@ private void attachWsdl() throws IOException {
}
getLog().debug("Packaging WSDL(s) to: " + target);
FileUtils.copyDirectory(getResourceDestDir(), target);
buildContext.refresh(target);
}

private String getWebappDirectory(Object conf) {
Expand Down

0 comments on commit fef9113

Please sign in to comment.