0

i am building a microservice using microservice-package-maven-plugin to package docker container. This works fine on build-server, but i would like to switch off thid docker packaging on my development environment, because i use windows and therefore no docker. At the moment i am editing the pom.xml true.. and true... Is there a better way to achieve this?

Can i add some command lines to my maven build like that? >mvn clean insatll -Dmicroservice.containerSkip=true ?

Or should i introduce maven profiles?

Thanks in advance

apes
  • 87
  • 8

2 Answers2

1

I am a bit late but this works for me:

Create a property in your pom:

<properties>
     <skip-docker-image>false</skip-docker-image>
</properties>

Use the property in the plugin config:

<configuration>
     <skip>${skip-docker-image}</skip>
</configuration>

Change the property when needed:

mvn clean install -Dskip-docker-image=true
TsTiX
  • 375
  • 2
  • 5
  • 1
    Thanks, good workaround. It is working. However, proposed parameters of maven plugin are not working. It should be fixed or documented that external configuration is only possible by addition property in pom, as described here. – apes Aug 13 '19 at 09:28
0

The parameters you are looking for are:

  • skip.agent.package (skips packaging in general)
  • skip.agent.package.rpm (skips rpm packaging)
  • skip.agent.package.container (skips docker container packaging)
  • skip.microservice.package (skips microservice zip packaging)

You can use any of this parameters as you described when building from command line.

mvn clean install -Dskip.agent.package.rpm=false -Dskip.agent.package.container=true

l2p
  • 420
  • 3
  • 9
  • Thank you, this is exactly what i was looking for. Unfortunatly it is not working! It is still building the docker container! I even did that: mvn `clean install -Dskip.agent.package.rpm=false -Dskip.agent.package.container=true -Dskip.microservice.package=true` – apes Jun 07 '18 at 14:45
  • [ERROR] Failed to execute goal com.nsn.cumulocity.clients-java:microservice-package-maven-plugin:9.5.0:package (package) on project oc2-data-mapper: Unable to execute mojo: Exception caught: java.util.concurrent.ExecutionException: com.spotify.docker.client.shaded.javax.ws.rs.ProcessingException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:2375 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect -> [Help 1] – apes Jun 07 '18 at 14:48