Daniel Espen | be80b3c | 2020-02-10 08:43:47 +0100 | [diff] [blame] | 1 | <project xmlns="http://maven.apache.org/POM/4.0.0" |
| 2 | xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" |
| 3 | xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| 4 | <modelVersion>4.0.0</modelVersion> |
| 5 | |
| 6 | <parent> |
| 7 | <groupId>org.eclipse.basyx</groupId> |
| 8 | <artifactId>basyx.components</artifactId> |
| 9 | <version>0.0.1-SNAPSHOT</version> |
| 10 | </parent> |
| 11 | |
| 12 | <artifactId>basyx.components.docker</artifactId> |
| 13 | <name>BaSyx Docker Base</name> |
| 14 | |
| 15 | <packaging>pom</packaging> |
| 16 | |
| 17 | <!-- Includes all components in this project as separated modules --> |
| 18 | <modules> |
| 19 | <module>basyx.components.simple</module> |
| 20 | <module>basyx.components.sqlregistry</module> |
| 21 | </modules> |
| 22 | |
| 23 | <build> |
| 24 | <pluginManagement> |
| 25 | <plugins> |
| 26 | <!-- Read maven properties from file --> |
| 27 | <plugin> |
| 28 | <groupId>org.codehaus.mojo</groupId> |
| 29 | <artifactId>properties-maven-plugin</artifactId> |
| 30 | <version>1.0.0</version> |
| 31 | <executions> |
| 32 | <execution> |
| 33 | <phase>initialize</phase> |
| 34 | <goals> |
| 35 | <goal>read-project-properties</goal> |
| 36 | </goals> |
| 37 | <configuration> |
| 38 | <files> |
| 39 | <file>${project.basedir}/src/test/resources/.env</file> |
| 40 | </files> |
| 41 | </configuration> |
| 42 | </execution> |
| 43 | </executions> |
| 44 | </plugin> |
| 45 | |
| 46 | <!-- Generate separate jar for tests and exclude logback.xml from generated jars --> |
| 47 | <!-- + create the executable jar --> |
| 48 | <plugin> |
| 49 | <groupId>org.apache.maven.plugins</groupId> |
| 50 | <artifactId>maven-jar-plugin</artifactId> |
| 51 | <version>3.1.1</version> |
| 52 | <configuration> |
| 53 | <archive> |
| 54 | <manifest> |
| 55 | <addClasspath>true</addClasspath> |
| 56 | <classpathPrefix>lib/</classpathPrefix> |
| 57 | <mainClass>${basyx.components.executable}</mainClass> |
| 58 | </manifest> |
| 59 | </archive> |
| 60 | <excludes> |
| 61 | <exclude>**/logback.xml</exclude> |
| 62 | </excludes> |
| 63 | <executions> |
| 64 | <execution> |
| 65 | <goals> |
| 66 | <goal>test-jar</goal> |
| 67 | </goals> |
| 68 | </execution> |
| 69 | </executions> |
| 70 | </configuration> |
| 71 | </plugin> |
| 72 | |
| 73 | <!-- Copy the dependencies necessary to run the jar --> |
| 74 | <plugin> |
| 75 | <groupId>org.apache.maven.plugins</groupId> |
| 76 | <artifactId>maven-dependency-plugin</artifactId> |
| 77 | <executions> |
| 78 | <execution> |
| 79 | <id>copy-dependencies</id> |
| 80 | <phase>prepare-package</phase> |
| 81 | <goals> |
| 82 | <goal>copy-dependencies</goal> |
| 83 | </goals> |
| 84 | <configuration> |
| 85 | <includeScope>compile</includeScope> |
| 86 | <outputDirectory>${project.build.directory}/lib/</outputDirectory> |
| 87 | </configuration> |
| 88 | </execution> |
| 89 | </executions> |
| 90 | </plugin> |
| 91 | |
| 92 | <!-- Build the docker image --> |
| 93 | <plugin> |
| 94 | <groupId>com.spotify</groupId> |
| 95 | <artifactId>dockerfile-maven-plugin</artifactId> |
| 96 | <version>1.4.10</version> |
| 97 | <executions> |
| 98 | <execution> |
| 99 | <id>default</id> |
| 100 | <goals> |
| 101 | <goal>build</goal> |
| 102 | </goals> |
| 103 | </execution> |
| 104 | </executions> |
| 105 | <configuration> |
| 106 | <repository>${BASYX_IMAGE_NAME}</repository> |
| 107 | <tag>${project.version}</tag> |
| 108 | <buildArgs> |
| 109 | <JAR_FILE>${project.build.finalName}.jar</JAR_FILE> |
| 110 | <PORT>${BASYX_CONTAINER_PORT}</PORT> |
| 111 | </buildArgs> |
| 112 | </configuration> |
| 113 | </plugin> |
| 114 | |
| 115 | <!-- Create integration test environment --> |
| 116 | <plugin> |
| 117 | <groupId>com.dkanejs.maven.plugins</groupId> |
| 118 | <artifactId>docker-compose-maven-plugin</artifactId> |
| 119 | <version>2.5.1</version> |
| 120 | <configuration> |
| 121 | <composeFile>${project.basedir}/docker-compose.yml</composeFile> |
| 122 | <detachedMode>true</detachedMode> |
| 123 | <envFile>${project.basedir}/src/test/resources/.env</envFile> |
| 124 | <envVars> |
| 125 | <BASYX_IMAGE_TAG>${project.version}</BASYX_IMAGE_TAG> |
| 126 | <BASYX_IMAGE_NAME>${BASYX_IMAGE_NAME}</BASYX_IMAGE_NAME> |
| 127 | <BASYX_CONTAINER_NAME>${BASYX_CONTAINER_NAME}</BASYX_CONTAINER_NAME> |
| 128 | <BASYX_CONTAINER_PORT>${BASYX_CONTAINER_PORT}</BASYX_CONTAINER_PORT> |
| 129 | <BASYX_HOST_PORT>${BASYX_HOST_PORT}</BASYX_HOST_PORT> |
| 130 | </envVars> |
| 131 | </configuration> |
| 132 | <executions> |
| 133 | <execution> |
| 134 | <id>docker-compose-up</id> |
| 135 | <phase>pre-integration-test</phase> |
| 136 | <goals> |
| 137 | <goal>up</goal> |
| 138 | </goals> |
| 139 | </execution> |
| 140 | <execution> |
| 141 | <id>docker-compose-down</id> |
| 142 | <phase>post-integration-test</phase> |
| 143 | <goals> |
| 144 | <goal>down</goal> |
| 145 | </goals> |
| 146 | </execution> |
| 147 | </executions> |
| 148 | </plugin> |
| 149 | |
| 150 | |
| 151 | <!-- Run integration tests --> |
| 152 | <plugin> |
| 153 | <groupId>org.apache.maven.plugins</groupId> |
| 154 | <artifactId>maven-failsafe-plugin</artifactId> |
| 155 | <version>2.20.1</version> |
| 156 | <executions> |
| 157 | <execution> |
| 158 | <goals> |
| 159 | <goal>integration-test</goal> |
| 160 | <goal>verify</goal> |
| 161 | </goals> |
| 162 | </execution> |
| 163 | </executions> |
| 164 | </plugin> |
| 165 | </plugins> |
| 166 | </pluginManagement> |
| 167 | </build> |
| 168 | |
| 169 | <!-- Defines common dependencies for all docker components --> |
| 170 | <dependencies> |
| 171 | <!-- Depends on the components library --> |
| 172 | <dependency> |
| 173 | <groupId>org.eclipse.basyx</groupId> |
| 174 | <artifactId>basyx.components.lib</artifactId> |
| 175 | <version>${project.version}</version> |
| 176 | </dependency> |
| 177 | </dependencies> |
| 178 | </project> |