You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by "KARR, DAVID" <dk...@att.com> on 2016/08/17 18:04:51 UTC
Building Docker image works in subproject, not from aggregator
I'm using the "docker-maven-plugin" to build a simple image based on TomEE. This is one subproject in a small multiproject build. Two other subprojects build the webapps that are installed into the TomEE instance.
I've been able to get the image to build by building from the "image" subproject. However, when I start the build from the parent aggregator, it gets confused about path references, and fails.
The following is the relevant excerpt from the POM:
---------------------------
<plugin>
<groupId>com.spotify</groupId>
<artifactId>docker-maven-plugin</artifactId>
<executions>
<execution>
<id>build-image</id>
<phase>package</phase>
<goals>
<goal>build</goal>
</goals>
</execution>
</executions>
<configuration>
<dockerDirectory>src/docker</dockerDirectory>
<imageName>ordersimage</imageName>
<resources>
<resource>
<directory>${project.build.directory}/dependencies</directory>
<includes>
<include>ordersService.war</include>
<include>ordersGUI.war</include>
<include>ojdbc6.jar</include>
</includes>
</resource>
<resource>
<directory>src/docker</directory>
<include>adjustTomEEXml.sh</include>
</resource>
</resources>
<buildArgs>
<tzoffset>${tzoffset}</tzoffset>
</buildArgs>
</configuration>
</plugin>
------------------
Again, when I build this project from the project directory, it builds the image properly. However, when I run the build from the parent aggregator, the image subproject fails with the following:
--------------------
[ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.11:build (build-image) on project ordersImage: Exception caught: basedir src/docker does not exist -> [Help 1]
---------------
It appears that one or both of the two "src/docker" references in the plugin configuration end up being dereferenced relative to the directory the main build is run from, instead of the project directory.
Based on those results, any idea what I should do to fix this?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
RE: Building Docker image works in subproject, not from aggregator
Posted by "KARR, DAVID" <dk...@att.com>.
> -----Original Message-----
> From: KARR, DAVID
> Sent: Wednesday, August 17, 2016 11:46 AM
> To: Maven Users List <us...@maven.apache.org>
> Subject: RE: Building Docker image works in subproject, not from
> aggregator
>
> > -----Original Message-----
> > From: ctrueden.wisc@gmail.com [mailto:ctrueden.wisc@gmail.com] On
> > Behalf Of Curtis Rueden
> > Sent: Wednesday, August 17, 2016 11:37 AM
> > To: Maven Users List <us...@maven.apache.org>
> > Subject: Re: Building Docker image works in subproject, not from
> > aggregator
> >
> > Hi David,
> >
> > Just a shot in the dark, but does it work to write:
> >
> > <directory>${baseDir}/src/docker</directory>
>
> Thanks for the reply.
>
> Since I posted this, I removed the "resource" entry that references
> "src/docker" because I realized it wasn't needed, but I still get the
> error, so the issue is likely due to the "dockerDirectory" value. In
> any case, I tried changing the value to "${basedir}/src/docker", but it
> made no difference.
Correction. I tested the "${basedir}" change in the wrong place (I have the project checked out in two locations in my Eclipse workspace, to make it easier to test this). Changing the "dockerDirectory" reference to use "${basedir}/src/docker" worked.
Would this be considered a bug? Wouldn't it make sense for a project to build the same way whether spawned from the project directory, or from the aggregator, without having to add extra syntax? I think I've seen this sort of notation in other places, so I have a feeling this is a common problem.
> > On Wed, Aug 17, 2016 at 1:04 PM, KARR, DAVID <dk...@att.com> wrote:
> >
> > > I'm using the "docker-maven-plugin" to build a simple image based on
> > > TomEE. This is one subproject in a small multiproject build. Two
> > > other subprojects build the webapps that are installed into the
> > > TomEE
> > instance.
> > >
> > > I've been able to get the image to build by building from the
> "image"
> > > subproject. However, when I start the build from the parent
> > > aggregator, it gets confused about path references, and fails.
> > >
> > > The following is the relevant excerpt from the POM:
> > > ---------------------------
> > > <plugin>
> > > <groupId>com.spotify</groupId>
> > > <artifactId>docker-maven-plugin</artifactId>
> > > <executions>
> > > <execution>
> > > <id>build-image</id>
> > > <phase>package</phase>
> > > <goals>
> > > <goal>build</goal>
> > > </goals>
> > > </execution>
> > > </executions>
> > > <configuration>
> > > <dockerDirectory>src/docker</dockerDirectory>
> > > <imageName>ordersimage</imageName>
> > > <resources>
> > > <resource>
> > > <directory>${project.build.dir
> > > ectory}/dependencies</directory>
> > > <includes>
> > > <include>ordersService.war</include>
> > > <include>ordersGUI.war</include>
> > > <include>ojdbc6.jar</include>
> > > </includes>
> > > </resource>
> > > <resource>
> > > <directory>src/docker</directory>
> > > <include>adjustTomEEXml.sh</include>
> > > </resource>
> > > </resources>
> > > <buildArgs>
> > > <tzoffset>${tzoffset}</tzoffset>
> > > </buildArgs>
> > > </configuration>
> > > </plugin>
> > > ------------------
> > >
> > > Again, when I build this project from the project directory, it
> > > builds the image properly. However, when I run the build from the
> > > parent aggregator, the image subproject fails with the following:
> > > --------------------
> > > [ERROR] Failed to execute goal
> > > com.spotify:docker-maven-plugin:0.4.11:build
> > > (build-image) on project ordersImage: Exception caught: basedir
> > > src/docker does not exist -> [Help 1]
> > > ---------------
> > >
> > > It appears that one or both of the two "src/docker" references in
> > > the plugin configuration end up being dereferenced relative to the
> > > directory the main build is run from, instead of the project
> > directory.
> > >
> > > Based on those results, any idea what I should do to fix this?
> > >
> > > --------------------------------------------------------------------
> > > - To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > > For additional commands, e-mail: users-help@maven.apache.org
> > >
> > >
> B
> KKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKKCB
> [ X ܚX KK[XZ[
>
> \ \ ][ X ܚX PX] [ \X K ܙ B ܈Y][ۘ[ [X[ K[XZ[
>
> \ \ Z[X] [ \X K ܙ B
RE: Building Docker image works in subproject, not from aggregator
Posted by "KARR, DAVID" <dk...@att.com>.
> -----Original Message-----
> From: ctrueden.wisc@gmail.com [mailto:ctrueden.wisc@gmail.com] On Behalf
> Of Curtis Rueden
> Sent: Wednesday, August 17, 2016 11:37 AM
> To: Maven Users List <us...@maven.apache.org>
> Subject: Re: Building Docker image works in subproject, not from
> aggregator
>
> Hi David,
>
> Just a shot in the dark, but does it work to write:
>
> <directory>${baseDir}/src/docker</directory>
Thanks for the reply.
Since I posted this, I removed the "resource" entry that references "src/docker" because I realized it wasn't needed, but I still get the error, so the issue is likely due to the "dockerDirectory" value. In any case, I tried changing the value to "${basedir}/src/docker", but it made no difference.
> On Wed, Aug 17, 2016 at 1:04 PM, KARR, DAVID <dk...@att.com> wrote:
>
> > I'm using the "docker-maven-plugin" to build a simple image based on
> > TomEE. This is one subproject in a small multiproject build. Two
> > other subprojects build the webapps that are installed into the TomEE
> instance.
> >
> > I've been able to get the image to build by building from the "image"
> > subproject. However, when I start the build from the parent
> > aggregator, it gets confused about path references, and fails.
> >
> > The following is the relevant excerpt from the POM:
> > ---------------------------
> > <plugin>
> > <groupId>com.spotify</groupId>
> > <artifactId>docker-maven-plugin</artifactId>
> > <executions>
> > <execution>
> > <id>build-image</id>
> > <phase>package</phase>
> > <goals>
> > <goal>build</goal>
> > </goals>
> > </execution>
> > </executions>
> > <configuration>
> > <dockerDirectory>src/docker</dockerDirectory>
> > <imageName>ordersimage</imageName>
> > <resources>
> > <resource>
> > <directory>${project.build.dir
> > ectory}/dependencies</directory>
> > <includes>
> > <include>ordersService.war</include>
> > <include>ordersGUI.war</include>
> > <include>ojdbc6.jar</include>
> > </includes>
> > </resource>
> > <resource>
> > <directory>src/docker</directory>
> > <include>adjustTomEEXml.sh</include>
> > </resource>
> > </resources>
> > <buildArgs>
> > <tzoffset>${tzoffset}</tzoffset>
> > </buildArgs>
> > </configuration>
> > </plugin>
> > ------------------
> >
> > Again, when I build this project from the project directory, it builds
> > the image properly. However, when I run the build from the parent
> > aggregator, the image subproject fails with the following:
> > --------------------
> > [ERROR] Failed to execute goal
> > com.spotify:docker-maven-plugin:0.4.11:build
> > (build-image) on project ordersImage: Exception caught: basedir
> > src/docker does not exist -> [Help 1]
> > ---------------
> >
> > It appears that one or both of the two "src/docker" references in the
> > plugin configuration end up being dereferenced relative to the
> > directory the main build is run from, instead of the project
> directory.
> >
> > Based on those results, any idea what I should do to fix this?
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> > For additional commands, e-mail: users-help@maven.apache.org
> >
> >
Re: Building Docker image works in subproject, not from aggregator
Posted by Curtis Rueden <ct...@wisc.edu>.
Hi David,
Just a shot in the dark, but does it work to write:
<directory>${baseDir}/src/docker</directory>
instead?
Regards,
Curtis
On Wed, Aug 17, 2016 at 1:04 PM, KARR, DAVID <dk...@att.com> wrote:
> I'm using the "docker-maven-plugin" to build a simple image based on
> TomEE. This is one subproject in a small multiproject build. Two other
> subprojects build the webapps that are installed into the TomEE instance.
>
> I've been able to get the image to build by building from the "image"
> subproject. However, when I start the build from the parent aggregator, it
> gets confused about path references, and fails.
>
> The following is the relevant excerpt from the POM:
> ---------------------------
> <plugin>
> <groupId>com.spotify</groupId>
> <artifactId>docker-maven-plugin</artifactId>
> <executions>
> <execution>
> <id>build-image</id>
> <phase>package</phase>
> <goals>
> <goal>build</goal>
> </goals>
> </execution>
> </executions>
> <configuration>
> <dockerDirectory>src/docker</dockerDirectory>
> <imageName>ordersimage</imageName>
> <resources>
> <resource>
> <directory>${project.build.dir
> ectory}/dependencies</directory>
> <includes>
> <include>ordersService.war</include>
> <include>ordersGUI.war</include>
> <include>ojdbc6.jar</include>
> </includes>
> </resource>
> <resource>
> <directory>src/docker</directory>
> <include>adjustTomEEXml.sh</include>
> </resource>
> </resources>
> <buildArgs>
> <tzoffset>${tzoffset}</tzoffset>
> </buildArgs>
> </configuration>
> </plugin>
> ------------------
>
> Again, when I build this project from the project directory, it builds the
> image properly. However, when I run the build from the parent aggregator,
> the image subproject fails with the following:
> --------------------
> [ERROR] Failed to execute goal com.spotify:docker-maven-plugin:0.4.11:build
> (build-image) on project ordersImage: Exception caught: basedir src/docker
> does not exist -> [Help 1]
> ---------------
>
> It appears that one or both of the two "src/docker" references in the
> plugin configuration end up being dereferenced relative to the directory
> the main build is run from, instead of the project directory.
>
> Based on those results, any idea what I should do to fix this?
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>