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

Project is out of date or in need of prerequisite information #9

Open
inletfetch opened this issue Jan 26, 2020 · 2 comments
Open

Project is out of date or in need of prerequisite information #9

inletfetch opened this issue Jan 26, 2020 · 2 comments

Comments

@inletfetch
Copy link

inletfetch commented Jan 26, 2020

I attempted to run each of the four build samples with the following command format:

mvn -P<profile_name> install

Only the fabric8 run completed without an error. The error is different in each of the other three cases. I would be happy to provide details of what I'm getting for each of the three failure cases, but I don't want to take the time to do so unless someone asks. I figure that maybe it is trivially easy for anyone to reproduce my results themselves, which would be simpler for all.

I'll also point out a problem that I had initially in running the fabric8 sample. It is a new thing to me that two different maven goals have to be run in the same command in order to work. I don't know if this is somewhat normal, but it threw me for a loop for some time before I figured out that this works:

mvn -Pfabric8 package docker:build

but this doesn't:

mvn -Pfabric8 package
mvn -Pfabric8 docker:build

I understand that building the package seeds some variable that is needed by the docker:build goal for it to succeed. This seems very unfortunate and counter-intuitive. I would suggest clearly stating this fact (and WHY it is) in the document, where it is implied that the latter command can be run in isolation.

@rhuss
Copy link
Collaborator

rhuss commented Jan 27, 2020

Thanks for your feedback ! You are right, this repository is outdated and probably will never be updated anymore, as most of the options (except fabric8/docker-maven-plugin) are out of service afaik. It server the purpose of its time, but should probably be archived.

To your issue with the package phase have to be run when using an assembly descriptor, there is a dedicated section in the documentation explaining that issue:

Maven peculiarities when including the artifact

If the assembly references the artifact to build with this pom, it is required that the package phase is included in the run. Otherwise the artifact file, can’t be found by docker:build. This is an old outstanding issue of the assembly plugin which probably can’t be fixed because of the way how Maven works. We tried hard to workaround this issue and in 90% of all cases, you won’t experience any problem. However, when the following warning happens which might lead to the given error:

[WARNING] Cannot include project artifact: io.fabric8:helloworld:jar:0.20.0; it doesn't have an associated file or directory.
[WARNING] The following patterns were never triggered in this artifact inclusion filter:
o  'io.fabric8:helloworld'

[ERROR] DOCKER> Failed to create assembly for docker image  (with mode 'dir'): Error creating assembly archive docker: You must set at least one file.

then you have two options to fix this:

  • Call mvn package docker:build to explicitly run "package" and "docker:build" in a chain.

  • Bind build to an to an execution phase in the plugin’s definition. By default docker:build will bind to the install phase is set in an execution. Then you can use a plain mvn install for building the artifact and creating the image.

<executions>
  <execution>
    <id>docker-build</id>
    <goals>
       <goal>build</goal>
    </goals>
  </execution>
</executions>

However, you perfectly run dmp also with a plain Dockerfile which does not suffer from this issue.

@rhuss
Copy link
Collaborator

rhuss commented Jan 27, 2020

to be clear, this is not a dmp limitation, but a limitation of Maven itself: https://issues.apache.org/jira/browse/MASSEMBLY-94

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