I'm developing a client for one of my servers. I am testing the client using Restito (similar to WireMock). I have created a muli-module maven project with a 'client' module and a 'stub-service' module and a simple parent module to collect them together. (see layout below)
.
├── client
│ └── pom.xml
├── pom.xml
└── stub-server
└── pom.xml
I want to be able to release and package them in one step, so that users of the client can import the stub service for the appropriate client on their integration tests.
This means that the client has a dependency on the stub-server module. The way currently have it set up is a dependency mess. I am using the maven-release-plugin but it doesn't seem to handle this situation very well and I am getting constant git merge conflicts and dependency issues. My goal is to:
- Deploy a versioned client
- Deploy a stub service (same version as client)
- client should be dependent (in test) on the stub service
- Tagged releases
Is this possible with maven? Should I package the whole thing as one jar and import into tests the stub and into production the client? (this is what I am trying to avoid as I don't want restito in my production application)
Here are my current POMs:
Parent
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<properties>
<maven.deploy.skip>true</maven.deploy.skip>
</properties>
<groupId>com.example</groupId>
<artifactId>service-client-parent</artifactId>
<version>1.1-SNAPSHOT</version>
<packaging>pom</packaging>
<scm>
<connection>scm:git:ssh://git@xxx</connection>
<developerConnection>scm:git:ssh://git@xxxx</developerConnection>
<tag>service-client-parent-1.1</tag>
</scm>
<modules>
<module>client</module>
<module>stub-server</module>
</modules>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
Client:
<?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/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.example</groupId>
<artifactId>service-client-parent</artifactId>
<version>1.1-SNAPSHOT</version>
</parent>
<properties>
<maven.deploy.skip>false</maven.deploy.skip>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>
</plugins>
</build>
<artifactId>servce-client</artifactId>
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<dependencies>
...
<!-- Test -->
<dependency>
<groupId>com.example</groupId>
<artifactId>service-stub-server</artifactId>
<version>1.1-SNAPSHOT</version>
<scope>test</scope>
</dependency>
</dependencies>
</project>
Stub:
<?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/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.exmaple</groupId>
<artifactId>profile-service-client-parent</artifactId>
<version>1.1-SNAPSHOT</version>
</parent>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.5.3</version>
</plugin>
</plugins>
</build>
<properties>
<maven.deploy.skip>false</maven.deploy.skip>
</properties>
<modelVersion>4.0.0</modelVersion>
<artifactId>service-stub-server</artifactId>
<dependencies>
<dependency>
<groupId>com.xebialabs.restito</groupId>
<artifactId>restito</artifactId>
<version>0.8.2</version>
</dependency>
</dependencies>
</project>
Thanks,
Ben
Aucun commentaire:
Enregistrer un commentaire