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

.metadata directory not copied into docker-build.tar and hence is missing from image #446

Closed
hallvard opened this issue May 13, 2016 · 6 comments

Comments

@hallvard
Copy link

hallvard commented May 13, 2016

My application is a headless Eclipse installation with a pre-made workspace. When building with maven, the Eclipse configuration and workspace is set up in another module, and then an inline assembly copies everything needed into the target/..../build/maven subdirectory of the target. I can see that this works properly by inspecting the resulting structure. However, the generated docker-build.tar does not include a particular directory named .metadata which is a very important part the Eclipse workspace. I needed to set useDefaultExcludes to false in the assembly to get it copied in the first place, but for some reason docker-build.tar and hence the image does not include the .metadata directory. I've looked for a place to control this part of the process, but found nothing. What am I missing?

@rhuss
Copy link
Collaborator

rhuss commented May 17, 2016

How does your configuration looks like ? You can use also an assembly descriptor for specifying the content of the docker.tar and you can set there also useDefaultExcludes to no.

@hallvard
Copy link
Author

hallvard commented May 17, 2016

Here's what's inside the plugin/configuration:

<!-- A single's image configuration -->
<image>
    <name>headless/equinox</name>
    <build>
        <from>java:8</from>
        <maintainer>Hallvard Traetteberg</maintainer>
        <tags>
            <tag>${project.version}</tag>
        </tags>
        <assembly>
            <basedir>/eclipsky</basedir>
            <inline>
                <fileSets>
                    <fileSet>
                        <directory>../no.hal.eclipsky.headless.equinox/target/equinox</directory>
                        <useDefaultExcludes>false</useDefaultExcludes>
                        <outputDirectory>equinox</outputDirectory>
                        <filtered>false</filtered>
                    </fileSet>
                </fileSets>
            </inline>
        </assembly>
        <ports>
            <port>8080</port>
        </ports>
        <workdir>eclipsky/equinox</workdir>
        <cmd>java -jar plugins/org.eclipse.equinox.launcher_1.3.200.v20160318-1642.jar -consoleLog</cmd>
    </build>
</image>

Here's the output of the maven command:

[INFO] --- docker-maven-plugin:0.15.1:build (build-image-and-start-container) @ no.hal.eclipsky.headless.docker ---
[INFO] Copying files to /Users/hal/java/git/eclipsky/no.hal.eclipsky.headless.docker/target/docker/headless/equinox/build/maven
[INFO] Building tar: /Users/hal/java/git/eclipsky/no.hal.eclipsky.headless.docker/target/docker/headless/equinox/tmp/docker-build.tar

If I understand it correctly, the first step copies the specified fileset/directory, while the second step creates the tar-file. The copy step seems to work since the ../no.hal.eclipsky.headless.equinox/target/equinox directory including the .metadata within it is correctly copied into a build/maven directory within the target directory of the project. See screenshot:
2016-05-18_0012
However, the second step does not do what I want, since the docker-build.tar does not contain the .metadata directory.

You write "You can use also an assembly descriptor for specifying the content of the docker.tar and you can set there also useDefaultExcludes to no." Should there be two assemblies or should there be additional instructions in the assembly I have for how the tar-file is built?

@hallvard
Copy link
Author

hallvard commented May 18, 2016

Followup: I've mvnDebug and found that when the DockerAssemblyManager builds the tar archive it uses DefaultFileSet to create the file set (see createBuildArchiver) and always sets useDefaultExcludes to true. So even though the assembly has useDefaultExcludes set to false, the archive will have it set it to true, and as far as I understand, the .metadata directory will be excluded. Please tell me I'm wrong and that this option can be set in the configuration!
P.S. Just to check, I set useDefaultExcludes of the archive's file set to false in the debugger, and the .metadata directory was included.

@rhuss
Copy link
Collaborator

rhuss commented May 18, 2016

@hallvard your are right, thats a bug. I just fixed it by setting useDefaultExcludes to false for this second step (which shouldnt harm since anyway since this can be tuned by the first extraction). It in branch integration.

I just deployed a 0.15.2-SNAPSHOT to Maven central, so feel free to test it.

Thanks for the report and finding the cause.

@hallvard
Copy link
Author

Switching to 0.15.2-SNAPSHOT seemed to work. Thanks for the quick response and fix!

@rhuss
Copy link
Collaborator

rhuss commented May 18, 2016

Cool ;-). I close the issue, feel free to reopen in case.

@rhuss rhuss closed this as completed May 18, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants