question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

m2e not picking up generated web resources

See original GitHub issue

I’ve been trying for a few days to get frontend-maven-plugin integrated to our web application build. I quickly got the pom.xml working to process a LESS file into CSS as part of building a WAR.

I added the plugin configured this way:

    <plugin>
        <groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <version>1.0</version>

        <installDirectory>target</installDirectory>

        <executions>

            <execution>
                <id>install node and npm</id>
                <goals>
                    <goal>install-node-and-npm</goal>
                </goals>
                <configuration>
                        <nodeVersion>v6.3.0</nodeVersion>
                        <npmVersion>2.15.8</npmVersion>
                </configuration>
            </execution>

            <execution>
                <id>install js packages</id>
                <goals>
                    <goal>npm</goal>
                </goals>
            </execution>

            <execution>
                <id>compile less</id>
                <goals>
                    <goal>gulp</goal>
                </goals>
                <configuration>
                    <srcdir>${basedir}/src/main/less</srcdir>
                    <outputdir>${project.build.directory}/generated-web-resources</outputdir>
                    <arguments>less</arguments>
                </configuration>
            </execution>
        </executions>
    </plugin>

I modified the maven-war-plugin to define additional web resources:

    <webResources combine.children="append">
        <resource>
            <directory>${project.build.directory}/generated-web-resources</directory>
        </resource>
    </webResources>

I’m struggling to get m2e integration to work; when I change the source LESS file, a build is triggered in Eclipse and the resulting CSS file gets written to ./target/generated-web-resources as expected. At this point, I expect the m2e integration to copy the file into the ./target/m2e-wtp/web-resources path, but it takes no action.

If I modify the generated CSS file and save, m2e picks up the change and copies the file to its location in ./target/m2e-wtp/web-resources.

Is there something I need to do in order to have m2e to pick up that there are newly generated files which it should be copying into its resources?

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:3
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
rtackcommented, May 15, 2017

@mriehema how does your comment address the problem. I’ve got the same issue as the others above. m2e-wtp picks up manual changes to the generated resources but does not pick up the files generated and refreshed by the frontend plugin

0reactions
stephanpelikancommented, Jan 1, 2018

You have to declare the directory as a webResource:

			<properties>
				<outputDirectory>${project.build.directory}/generated-web-resources</outputDirectory>
			</properties>
...
				<plugin>
					<groupId>org.apache.maven.plugins</groupId>
					<artifactId>maven-war-plugin</artifactId>
					<version>3.2.0</version>
					<configuration>
						<webResources>
							<resource>
								<directory>${outputDirectory}</directory>
							</resource>
						</webResources>
					</configuration>
				</plugin>
...
					<plugin>
						<groupId>com.github.eirslett</groupId>
						<artifactId>frontend-maven-plugin</artifactId>
						<executions>
...
							<execution>
								<id>webpack build</id>
								<goals>
									<goal>webpack</goal>
								</goals>
								<configuration>
									<arguments>
										-d
										--env.outputDirectory=${outputDirectory}
										--display-error-details
										--config ./webpack.dev.config.js
									</arguments>
									<outputdir>${outputDirectory}</outputdir>
								</configuration>
							</execution>
						</executions>
					</plugin>

Stephan

Read more comments on GitHub >

github_iconTop Results From Across the Web

Maven does not create the "/target/m2e-wtp/web-resources ...
Right click Project-> Properties -> DeploymentAssembly -> Remove /target/m2e-wtp/web-resources folder. · If no luck try this, Open project preferences -> Project ...
Read more >
[m2e-dev] Generated Resources not picked during first build.
Hi, I'm struggling to make an m2e-connector work as expected with m2e. The *maven-remote-resources-plugin* dynamically adds generated source ...
Read more >
Using Maven within the Eclipse IDE - Tutorial - Vogella.com
Right-click your project and select Maven Update Project and update your project. m2e newmavenproject44. 4.3. Update test. Update your generated ...
Read more >
Adding and Filtering External Web Resources - Apache Maven
The WAR Plugin is also capable of including resources not found in the default resource directory through the webResources parameter. Adding web ......
Read more >
Spring Boot, Maven and Eclipse Errors and TroubleShooting ...
Hal Browser and Spring Boot Actuator are not working! ... Q : What is the difference between web.xml and the Spring Context -...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found