PrepareFrontendMojo.java (vaadin-flow-4.0.4) | : | PrepareFrontendMojo.java (vaadin-flow-4.0.5) | ||
---|---|---|---|---|
skipping to change at line 49 | skipping to change at line 49 | |||
import com.vaadin.flow.server.Constants; | import com.vaadin.flow.server.Constants; | |||
import com.vaadin.flow.server.ExecutionFailedException; | import com.vaadin.flow.server.ExecutionFailedException; | |||
import com.vaadin.flow.server.frontend.FrontendTools; | import com.vaadin.flow.server.frontend.FrontendTools; | |||
import com.vaadin.flow.server.frontend.FrontendUtils; | import com.vaadin.flow.server.frontend.FrontendUtils; | |||
import com.vaadin.flow.server.frontend.NodeTasks; | import com.vaadin.flow.server.frontend.NodeTasks; | |||
import elemental.json.Json; | import elemental.json.Json; | |||
import elemental.json.JsonObject; | import elemental.json.JsonObject; | |||
import elemental.json.impl.JsonUtil; | import elemental.json.impl.JsonUtil; | |||
import static com.vaadin.flow.plugin.common.FlowPluginFrontendUtils.getClassFind er; | import static com.vaadin.flow.plugin.common.FlowPluginFrontendUtils.getClassFind er; | |||
import static com.vaadin.flow.server.Constants.CONNECT_APPLICATION_PROPERTIES_TO KEN; | import static com.vaadin.flow.server.Constants.CONNECT_APPLICATION_PROPERTIES_TO KEN; | |||
import static com.vaadin.flow.server.Constants.CONNECT_GENERATED_TS_DIR_TOKEN; | import static com.vaadin.flow.server.Constants.CONNECT_GENERATED_TS_DIR_TOKEN; | |||
import static com.vaadin.flow.server.Constants.CONNECT_JAVA_SOURCE_FOLDER_TOKEN; | import static com.vaadin.flow.server.Constants.CONNECT_JAVA_SOURCE_FOLDER_TOKEN; | |||
import static com.vaadin.flow.server.Constants.CONNECT_OPEN_API_FILE_TOKEN; | import static com.vaadin.flow.server.Constants.CONNECT_OPEN_API_FILE_TOKEN; | |||
import static com.vaadin.flow.server.Constants.FRONTEND_TOKEN; | import static com.vaadin.flow.server.Constants.FRONTEND_TOKEN; | |||
import static com.vaadin.flow.server.Constants.GENERATED_TOKEN; | import static com.vaadin.flow.server.Constants.GENERATED_TOKEN; | |||
import static com.vaadin.flow.server.Constants.NPM_TOKEN; | import static com.vaadin.flow.server.Constants.NPM_TOKEN; | |||
import static com.vaadin.flow.server.Constants.SERVLET_PARAMETER_INITIAL_UIDL; | import static com.vaadin.flow.server.Constants.SERVLET_PARAMETER_INITIAL_UIDL; | |||
import static com.vaadin.flow.server.Constants.SERVLET_PARAMETER_PRODUCTION_MODE ; | import static com.vaadin.flow.server.Constants.SERVLET_PARAMETER_PRODUCTION_MODE ; | |||
import static com.vaadin.flow.server.Constants.SERVLET_PARAMETER_USE_V14_BOOTSTR AP; | import static com.vaadin.flow.server.Constants.SERVLET_PARAMETER_USE_V14_BOOTSTR AP; | |||
import static com.vaadin.flow.server.frontend.FrontendUtils.DEAULT_FLOW_RESOURCE S_FOLDER; | import static com.vaadin.flow.server.frontend.FrontendUtils.DEAULT_FLOW_RESOURCE S_FOLDER; | |||
import static com.vaadin.flow.server.frontend.FrontendUtils.TOKEN_FILE; | import static com.vaadin.flow.server.frontend.FrontendUtils.TOKEN_FILE; | |||
/** | /** | |||
* This goal checks that node and npm tools are installed, copies frontend | * This goal checks that node and npm tools are installed and creates | |||
* resources available inside `.jar` dependencies to `node_modules`, and creates | ||||
* or updates `package.json` and `webpack.config.json` files. | * or updates `package.json` and `webpack.config.json` files. | |||
* <p> | ||||
* Copies frontend resources available inside `.jar` dependencies to | ||||
* `node_modules` when building a jar package. | ||||
* | * | |||
* @since 2.0 | * @since 2.0 | |||
*/ | */ | |||
@Mojo(name = "prepare-frontend", requiresDependencyResolution = ResolutionScope. COMPILE_PLUS_RUNTIME, defaultPhase = LifecyclePhase.PROCESS_RESOURCES) | @Mojo(name = "prepare-frontend", requiresDependencyResolution = ResolutionScope. COMPILE_PLUS_RUNTIME, defaultPhase = LifecyclePhase.PROCESS_RESOURCES) | |||
public class PrepareFrontendMojo extends FlowModeAbstractMojo { | public class PrepareFrontendMojo extends FlowModeAbstractMojo { | |||
@Parameter(defaultValue = "${project}", readonly = true, required = true) | @Parameter(defaultValue = "${project}", readonly = true, required = true) | |||
private MavenProject project; | private MavenProject project; | |||
/** | /** | |||
skipping to change at line 140 | skipping to change at line 141 | |||
.useV14Bootstrap(useDeprecatedV14Bootstrapping()) | .useV14Bootstrap(useDeprecatedV14Bootstrapping()) | |||
.withFlowResourcesFolder(flowResourcesFolder) | .withFlowResourcesFolder(flowResourcesFolder) | |||
.createMissingPackageJson(true) | .createMissingPackageJson(true) | |||
.enableImportsUpdate(false) | .enableImportsUpdate(false) | |||
.enablePackagesUpdate(false) | .enablePackagesUpdate(false) | |||
.runNpmInstall(false) | .runNpmInstall(false) | |||
.withNodeVersion(nodeVersion) | .withNodeVersion(nodeVersion) | |||
.withNodeDownloadRoot(nodeDownloadRootURI) | .withNodeDownloadRoot(nodeDownloadRootURI) | |||
.withHomeNodeExecRequired(requireHomeNodeExec); | .withHomeNodeExecRequired(requireHomeNodeExec); | |||
// If building a jar project copy jar artifact contents now as we | // If building a jar project copy jar artifact contents now as we | |||
// might | // might not be able to read files from jar path. | |||
// not be able to read files from jar path. | ||||
if ("jar".equals(project.getPackaging())) { | if ("jar".equals(project.getPackaging())) { | |||
Set<File> jarFiles = project.getArtifacts().stream() | Set<File> jarFiles = project.getArtifacts().stream() | |||
.filter(artifact -> "jar".equals(artifact.getType())) | .filter(artifact -> "jar".equals(artifact.getType())) | |||
.map(Artifact::getFile).collect(Collectors.toSet()); | .map(Artifact::getFile).collect(Collectors.toSet()); | |||
builder.copyResources(jarFiles); | builder.copyResources(jarFiles); | |||
} | } | |||
builder.build().execute(); | builder.build().execute(); | |||
} catch (ExecutionFailedException exception) { | } catch (ExecutionFailedException exception) { | |||
throw new MojoFailureException( | throw new MojoFailureException( | |||
End of changes. 4 change blocks. | ||||
5 lines changed or deleted | 5 lines changed or added |