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

Update project structure to mimic real use case #7

Open
wants to merge 1 commit into
base: external-microservice
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions external-microservice/framework/framework-lib/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@

<parent>
<groupId>com.example.framework</groupId>
<artifactId>framework-parent</artifactId>
<artifactId>framework-agg</artifactId>
<version>0</version>
<relativePath>../framework-parent</relativePath>
</parent>

<artifactId>framework-lib</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<parent>
<groupId>com.example.framework</groupId>
<artifactId>framework-agg</artifactId>
<version>0</version>
</parent>

<artifactId>framework-microservice-parent</artifactId>
<packaging>pom</packaging>
<description>A parent for the microservices developed under this framework.</description>


<dependencyManagement>
<dependencies>
<dependency>
<groupId>com.example.framework</groupId>
<artifactId>framework-lib</artifactId>
<!--
| Using ${project.version} here will not work, as when microservice project is being built, the value
| resolves to `1` (which is the microservice version), instead of `0` (which is the framework one).
|
| Using ${project.parent.version} will work instead, but ONLY as long as, microservice does not
| define its own parent proxying this one (which would have a diff version). So looks like a fragile
| workaround.
|
| This is not related to JGitVer, but Maven itself. But could be a use case to integrate everything
| together :)
| * Is there any way to solve this use-case in Maven? Maybe doing something different?
|-->
<!-- <version>${project.version}</version> -->
<version>${project.parent.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
</project>
23 changes: 0 additions & 23 deletions external-microservice/framework/framework-parent/pom.xml

This file was deleted.

26 changes: 17 additions & 9 deletions external-microservice/framework/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,21 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.example.framework</groupId>
<artifactId>framework-agg</artifactId>
<version>0</version>
<packaging>pom</packaging>

<modules>
<module>framework-parent</module>
<module>framework-lib</module>
</modules>
<groupId>com.example.framework</groupId>
<artifactId>framework-agg</artifactId>
<version>0</version>
<packaging>pom</packaging>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<java.version>11</java.version>
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
</properties>

<modules>
<module>framework-lib</module>
<module>framework-microservice-parent</module>
</modules>

</project>
8 changes: 4 additions & 4 deletions external-microservice/microservice/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@

<parent>
<groupId>com.example.framework</groupId>
<artifactId>framework-parent</artifactId>
<version>0</version>
<artifactId>framework-microservice-parent</artifactId>
<version>0</version> <!-- using framework version F -->
</parent>

<groupId>com.example.application</groupId>
<artifactId>microservice</artifactId>
<version>1</version>
<version>1</version> <!-- but microservice application will have its own version M -->
<packaging>jar</packaging>

<dependencies>
<dependency>
<groupId>com.example.framework</groupId>
<artifactId>framework-lib</artifactId>
<artifactId>framework-lib</artifactId> <!-- expected always to be framework version F -->
</dependency>
</dependencies>
</project>