Java Maven:构建儿童项目的Docker映像
我的项目具有以下结构:Java Maven:构建儿童项目的Docker映像,java,maven,docker,spring-boot,Java,Maven,Docker,Spring Boot,我的项目具有以下结构: pom.xml | x----child1 | | | x----pom.xml | x----child2 | x----pom.xml 有一个爸爸和两个孩子。孩子们的构建使用Spotify插件生成项目的Docker图像。我的问题是,如何从根目录调用这两个构建?我基本上需要调用构建在子模块上的spotify插件。 我试着用 mvn clean install 但是这些孩子是用maven编
pom.xml
|
x----child1
| |
| x----pom.xml
|
x----child2
|
x----pom.xml
有一个爸爸和两个孩子。孩子们的构建使用Spotify插件生成项目的Docker图像。我的问题是,如何从根目录调用这两个构建?我基本上需要调用构建在子模块上的spotify插件。
我试着用
mvn clean install
但是这些孩子是用maven编译器插件构建的,而不是docker maven插件
这是我在儿童中使用的构建:
<build>
<plugins>
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>${spotify.plugin.version}</version>
<configuration>
<imageName>childImage</imageName>
<dockerDirectory>${project.build.directory}/../src/docker</dockerDirectory>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>${project.build.directory}</directory>
<include>${project.build.finalName}.jar</include>
</resource>
</resources>
</configuration>
</plugin>
</plugins>
</build>
com.spotify
docker maven插件
${spotify.plugin.version}
儿童形象
${project.build.directory}/./src/docker
/
${project.build.directory}
${project.build.finalName}.jar
在pom中,我已经定义了这样的模块
<modules>
<module>child1</module>
<module>child2</module>
</modules>
孩子1
孩子2
谢谢你的建议 尝试将以下内容添加到插件中:
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
安装
建造
尝试将以下内容添加到插件中:
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
安装
建造
您有两个选项来解决此问题:
<build>
<plugins>
...
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<imageName>example</imageName>
<baseImage>example</baseImage>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>target</directory>
<include>example.war</include>
</resource>
</resources>
</configuration>
</plugin>
...
</plugins>
</build>
...
com.spotify
docker maven插件
0.4.13
建造
包裹
例子
例子
/
目标
例如:战争
...
您有两个选项来解决此问题:
<build>
<plugins>
...
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<version>0.4.13</version>
<executions>
<execution>
<goals>
<goal>build</goal>
</goals>
<phase>package</phase>
</execution>
</executions>
<configuration>
<imageName>example</imageName>
<baseImage>example</baseImage>
<resources>
<resource>
<targetPath>/</targetPath>
<directory>target</directory>
<include>example.war</include>
</resource>
</resources>
</configuration>
</plugin>
...
</plugins>
</build>
...
com.spotify
docker maven插件
0.4.13
建造
包裹
例子
例子
/
目标
例如:战争
...