1

I am attempting to run my JHipster Microservice application as a Docker image. I want to spin up a development container for testing. The application runs without Liquibase using the no-liquibase profile.

I run the following command:

mvnw package -Pdev,swagger,no-liquibase verify jib:dockerBuild

However, the output I am getting confirms that no profile has been found:

No active profile set, falling back to default profiles: default

I then get errors in the logs relating to Liquibase (which should be disabled). For example:

Error creating bean with name 'liquibase' defined in class path resource [com/treasury/prime/ms/config/LiquibaseConfiguration.class]: Invocation of init method failed; nested exception is liquibase.exception.MigrationFailedException: Migration failed for change set config/liquibase/changelog/20191114045739_added_entity_Risk.xml::20191114045739-1::jhipster:
     Reason: liquibase.exception.DatabaseException: Table already exists;

How can I build the docker image with dev,no-liquibase,swagger profiles active?

Semo
  • 783
  • 2
  • 17
  • 38
Steve Macleod
  • 45
  • 1
  • 9

1 Answers1

0

Looks like the following message is about active Spring profiles, not Maven profiles. See this Stack Overflow question too.

No active profile set, falling back to default profiles: default

I am certain that the dev, no-liquibase, and swagger Maven profiles are already active. Otherwise, you would have seen a different error message.

Chanseok Oh
  • 3,920
  • 4
  • 23
  • 63
  • Thanks for the response. The Stack Overflow question link doesnt seem to work. Can you provide the correct one? – Steve Macleod Mar 17 '20 at 04:06
  • Any idea why the Spring Profiles are not being substituted from the -Pdev,swagger,no-liquibase ? – Steve Macleod Mar 17 '20 at 05:02
  • Sorry, I've fixed the SO link. Check that again. Maven profiles are Spring profiles are totally unrelated (unless the project is specifically set them in some related way). And I imagine it is entirely possible that the "No active profile set" message is not really an error but the way the project is set up to work. (For example, the default works and the project didn't bother eliminating all minor warnings.) I wonder if you have the evidence that the Spring active profile using the default is really the cause of the ultimate failure? – Chanseok Oh Mar 17 '20 at 14:09
  • I can see that the Spring profile is being set for both the prod and dev profiles: ` dev${profile.tls} ` The following passes through the Spring profile: `mvn -Pprod` and `mvnw -Pprod` No profile is passed when I run `mvnw -Pprod clean verify` I see when a Spring profile is active via: `The following profiles are active: prod` – Steve Macleod Mar 18 '20 at 05:09
  • Seems that whenever I add a Maven lifecycle/phase/goal to the command the profile is not passed to Spring. – Steve Macleod Mar 18 '20 at 05:15
  • I think things are working normally and you just have some configuration issue around this in `pom.xml`. For example, some goals are bound to `verify`, or it auto-activates (or deactivates) some profiles. – Chanseok Oh Mar 19 '20 at 16:32