Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

resources removed from target/classes/ after editing just maven dependencies (regression) #1620

Closed
basinilya opened this issue Dec 10, 2023 · 2 comments

Comments

@basinilya
Copy link

After editing the <dependencies> section in pom.xml (but not the other parts) and saving the file the resources are removed from target/classes (.class files stay there). To bring the resource back, a meaningless edit (a whitespace change) is sufficient in either pom.xml, a java file or a resource file. Having combined or separate java and resources folders does not make a difference.

It's still the case in Eclipse 2023-12 with m2e 2.4.300.20231203-1234 updated from latest.
I first noticed it in Eclipse 2023-09 with m2e 2.4.100 and it was working fine in Eclipse 2021-03 with m2e 1.17.2.

To reproduce, create a maven project with jar packaging, default layout, and create one resource file and one java file. Edit pom.xml by adding or removing a dependency. Go to target/classes/ and see that only the .class file is there. Edit pom.xml again and see that the resource and the manifest are created. Example pom:

<?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>
	<groupId>org.foo</groupId>
	<artifactId>m2e-bug</artifactId>
	<version>0.1-SNAPSHOT</version>
	<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
	</properties>
	<dependencies>
		<!-- uncomment: -->	
		<!--
			<dependency>
			<groupId>commons-net</groupId>
			<artifactId>commons-net</artifactId>
			<version>3.8.0</version>
		</dependency>
-->
	</dependencies>
	<build>
		<plugins>
			<plugin>
				<artifactId>maven-compiler-plugin</artifactId>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

eclipse-configuration.txt

@HannesWell
Copy link
Contributor

Duplicate of #1511

@HannesWell HannesWell marked this as a duplicate of #1511 Dec 10, 2023
@HannesWell
Copy link
Contributor

Thanks for this issue, but it looks like this is a duplicate of #1511.
I'll close this as such, please follow that issue for updates.
If you think this isn't a duplicate please let me know and reopen this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants