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

Flattened pom for core project invalid #164

Closed
maybeec opened this issue Oct 27, 2019 · 7 comments · Fixed by #335
Closed

Flattened pom for core project invalid #164

maybeec opened this issue Oct 27, 2019 · 7 comments · Fixed by #335
Labels
enhancement New feature or request SCM Software-configuration-management (maven, travis, etc.) template maven-archetype to create new application.

Comments

@maybeec
Copy link
Member

maybeec commented Oct 27, 2019

Expected behavior

As an architect, I want package all modules of my software so that I can individually build and test each of the maven modules separately.

Actual behavior

Having the core maven module deployed, a dependent software module build like the batch module states, that the deployed pom.xml of the core module is not valid as of dependency version not set for

        <dependency>
          <groupId>org.springframework.boot</groupId>
          <artifactId>spring-boot-starter-tomcat</artifactId>
        </dependency>

Steps to reproduce (bug) / Use Case of feature request (enhancement)

  1. create new project by archetype
  2. run mvn clean install on the entire multi-module project
  3. go to batch module folder
  4. run mvn clean test

Related/Dependent Issues

mojohaus/flatten-maven-plugin#70

@maybeec maybeec added the bug Something isn't working label Oct 27, 2019
@hohwille
Copy link
Member

@maybeec Thanks for the feedback and also the link to the flatten issue you found.
Seems I do have some homework here. That is the drawback when you are starting many OSS projects trying to make the world better, you earn lots of maintenance effort. As I began flatten-maven-plugin more as a kind of PoC to show the maven community how a better maven should look like in the future, I might need to find another maintainer for this on the long run. However, for this issue I will try my best to find a fix and ship a new version. However, I can not primise this before end of November.

@hohwille
Copy link
Member

However, if I read your report carefully I come to the impression that we are creating an entirely invalid POM here. That does not only mean that the local build of the batch module is somehow problematic but the entire "release" of that module is kind of invalid and if some other project would import that dependency it would also not work.
I can not say how much of a blocker that is, but it sounds like a rather bad bug and not just a nice to have issue.

@hohwille hohwille added blocker SCM Software-configuration-management (maven, travis, etc.) labels Apr 2, 2020
@hohwille hohwille added this to the release:2020.04.001 milestone Apr 2, 2020
@hohwille
Copy link
Member

hohwille commented Apr 2, 2020

@hohwille
Copy link
Member

hohwille commented Apr 2, 2020

Can someone shed some light into this issue?
I created a devon4j project from the latest archetype from develop branch.
There is not flattening happening at all. Did we disable flatten plugin in archetype already as a quickfix for this issue long time ago?
In the toplevel POM of the archetype flatten plugin is configured in pluginManagement but the plugin itself is not used in build->plugins so the entire issue is invalid.
Can someone confirm before I close this issue?

@hohwille
Copy link
Member

hohwille commented Apr 2, 2020

Even the archetype POM from the first commit of devon4j did not activate flatten plugin:
https://github.com/devonfw/devon4j/blob/9b8f9461997bb5d8048a9fec42bec3625652eec3/templates/server/src/main/resources/archetype-resources/pom.xml

This issue does not make any sense to me. I will have to close as invalid.
@maybeec if you have anything to shed some light into this and indicate what I might be missing, please go ahead.

@hohwille
Copy link
Member

hohwille commented Apr 2, 2020

Step 1:

devon java create com.example.mydemo -Dbatch=batch
Trying to determine the latest available version from https://repo.maven.apache.org/maven2/com/devonfw/java/templates/devon4j-template-server/maven-metadata.xml
Running: /Users/hohwille/projects/test/software/maven/bin/mvn archetype:generate -DarchetypeGroupId=com.devonfw.java.templates -DarchetypeArtifactId=devon4j-template-server -DinteractiveMode=false -Dbatch=batch -Dpackage=com.example.mydemo -DartifactId=mydemo -DgroupId=com.example -Dversion=1.0.0-SNAPSHOT -DarchetypeVersion=3.2.1

Step 2:

mvn clean install
...
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  27.427 s
[INFO] Finished at: 2020-04-02T20:54:33+02:00
[INFO] ------------------------------------------------------------------------

Step 3:

cd batch

Step 4:

mvn clean test
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.074 s
[INFO] Finished at: 2020-04-02T20:56:31+02:00
[INFO] ------------------------------------------------------------------------```

@hohwille hohwille closed this as completed Apr 2, 2020
@hohwille hohwille added invalid This doesn't seem right and removed SCM Software-configuration-management (maven, travis, etc.) blocker bug Something isn't working labels Apr 2, 2020
@hohwille hohwille modified the milestones: release:2020.04.001, rejected Apr 2, 2020
@maybeec
Copy link
Member Author

maybeec commented Jan 25, 2021

The problem should automatically occur if "embedded" profile is enabled, which is enabled by default: https://github.com/devonfw/devon4j/blob/master/templates/server/src/main/resources/archetype-resources/core/pom.xml#L233

Anyhow, the issue possibly also is caused by a slightly different setup in my project as I added the test resources to the batch run as well to not have redundant test properties etc to be configured:

<plugin>
	<groupId>org.apache.maven.plugins</groupId>
	<artifactId>maven-jar-plugin</artifactId>
	<executions>
		<execution>
			<goals>
				<goal>test-jar</goal>
			</goals>
		</execution>
	</executions>
</plugin>

to core and include

<dependency>
	<groupId>${project.groupId}</groupId>
	<artifactId>?-core</artifactId>
	<version>${project.version}</version>
	<type>test-jar</type>
	<scope>test</scope>
</dependency>

to batch pom.xml. At least, this is the change we did.

@maybeec maybeec reopened this Jan 25, 2021
@maybeec maybeec removed the invalid This doesn't seem right label Feb 3, 2021
@hohwille hohwille modified the milestones: rejected, release:2020.12.003 Feb 18, 2021
@hohwille hohwille added bug Something isn't working SCM Software-configuration-management (maven, travis, etc.) template maven-archetype to create new application. labels Feb 18, 2021
@hohwille hohwille linked a pull request Feb 18, 2021 that will close this issue
@hohwille hohwille added enhancement New feature or request and removed bug Something isn't working labels Feb 18, 2021
@hohwille hohwille modified the milestones: release:2020.12.003, release:2021.04.001 Apr 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request SCM Software-configuration-management (maven, travis, etc.) template maven-archetype to create new application.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants