I am new in docker, I want to know how to install dependency locally in maven while using docker compose yml file.
Like, I have 3 micro services and those I configured in docker-compose.yml file but I want one dependency to be installed in local maven using maven install so that I can use that dependency in other micro services by importing.
Is this possible ?
Thanks in advance.
Related
I am using Google App Engine gradle plugin with yaml file, but the plugin version for it has no task appengineRun or appengineStart like the appengine-web.xml version.
TL;DR appengineRun is only available for appengine-web.xml based projects. If you want to use app.yaml, you must provide your own server, for example Spring Boot with Jetty or Tomcat.
To run your application locally, you must provide your own server.
This guide shows how to test your application using app.yaml alongside with the app-gradle-plugin, on section Testing your application with the development server:
During the development phase, you can run and test your application at any time in the development server by invoking Gradle:
gradle jettyRun
Alternatively, you can run Gradle without installing it by using the Gradle wrapper.
As said on this comment on GitHub:
If you want to use app.yaml from your root directory, you must upgrade to Java 11. Learn more here. With the Java 11 runtime, you must provide your own server, for example Spring Boot with Jetty or Tomcat. The appengine:run goal does not work for app.yaml based projects because each server has a different start up command i.e. spring-boot:run for Spring Boot.
I have docker-compose with the following projects:
RabbitMQ management, producer and consumer,
producer and consumer (java springboot apps) share a maven dependency to common model api (3rd mini project containing POJOs used by producer and consumer).
When I build everything locally with mvn and each dockerfile contains only copying jar and running the app everything works fine.
I tried to use multi-stage dockerfile but there is an error stating my producer can't find dependency for model-api on maven-central (from where it downloads all other dependencies).
I have tried using RUN mvn dependency:go-offline so it uses my local .m2/repo but no success, same error and still downloads dependencies from central.
How can I make it work?
I am working a Java REST api for a hobby project and I am using Heroku as my deployment platform. I managed to deploy the application using
heroku-maven-plugin.
Then I integrated my GitHub repo with heroku app and tried to deploy from master branch. But then it fails with the following message
Failed to detect set buildpack https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/java.tgz
More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
!Push failed
Can you please explain how to fix this?
Update :
I have tried setting the buildpack to heroku/java from both dashboard and the heroku CLI tool. But still the problem remains.
GitHub : online-activity-diary-api
The Heroku Maven plugin and Github deployment to the same app are not compatible. They use different buildpacks that do different work. You'll first need to make sure your deploying to different apps with these two mechanisms.
When you deploy with Github sync, you'll need to make sure your buildpack is configured to heroku/java in the dashboard. Then make sure your application has a pom.xml checked into Git.
How can I automatically deploy a war from Nexus to Tomcat?
I have a maven web project which gets built and deployed (both SNAPSHOT and release versions) on Nexus successfully. I would like to know if there is feature/plugin in Nexus where it picks the released war and deploys on remote Tomcat automatically?
I know that you can deploy the war to remote Tomcat using maven-tomcat-plugin but would like to know if there is an alternative solution.
Please guide.
Typically you'd use a CI tool like Jenkins to run the Maven build that publishes your War file into Nexus. Nexus would then be used by whatever tool you're using to push the War onto the target tomcat environment:
There are lots and lots of options.
Jenkins post build SSH script
Run a post-build SSH task from Jenkins that does something like this on the target tomcat server:
curl "http://myrepo/nexus/service/local/artifact/maven/redirect?r=releases&g=myorg&a=myapp&v=1.1&e=war" \
-o /usr/local/share/tomcat7/webapps/myapp.war
service tomcat7 restart
Rundeck
My preference is to use Rundeck for deployments, because it has a Nexus plugin, providing convenient drop-down menus of available releases.
There is also a Rundeck plugin for Jenkins that can be used to orchestrate a CI process with Jenkins performing the build, hand-over to Rundeck for deployment, followed by a Jenkins call-back to run the integration tests.
Chef
I also use chef which can be used to automatically deploy software in a pull fashion.
The artifact cookbook has direct support for Nexus, whereas the application_java cookbook uses a more generic "pull from a URL" approach that also works well.
..
..
The list goes on, so I hope this helps.
We used UrbanCode for the deployment automation, retrieves war from Artifactory/Nexus and deploy to the target server.
I used the Nexus Rest-API, these endpoints downloads the artifact to Jenkins workspace.
In order to deploy Snapshot & Release to Tomcat we can create a Jenkins parameterized job and pass the parameters to the REST endpoint, also to deploy to a server like Tomact "Deploy WAR/EAR" Jenkins plugin will help.
We can parameterize the endpoint and use as part of "Build" step along with "Execute Shell script" option for the build.
wget --user=${UserName} --password=${Password} "http://192.168.49.131:8080/nexus/service/local/artifact/maven/redirect?r=releases&g=${GroupId}&a=${ArtifactId}&v=${Version}&e=${TypeOfArtifact}" --content-disposition
Actual endpoints to Nexus looks something like below.
wget --user=admin --password=admin123 "http://localhost:8080/nexus/service/local/artifact/maven/redirect?r=snapshots&g=org.codezarvis.artifactory&a=hushly&v=0.0.1-SNAPSHOT&e=jar" --content-disposition
wget --user=admin --password=admin123 "http://localhost:8080/nexus/service/local/artifact/maven/redirect?r=releases&g=org.codezarvis.artifactory&a=hushly&v=0.0.5&e=jar" --content-disposition
Thanks
-Sudarshan
is it possible to run spring mvc application on tomcat(with this plugin http://mojo.codehaus.org/tomcat-maven-plugin/) if yes, where is the application log and deploy web app directory located ?
Let me rephrase the question. I'm asking for some way to start my web app(spring mvc application) from a command line, either with maven or with something inside application that creates web server.
What would you recommend? I found this tomcat maven plugin while googling, no special reason to use it
Currently I use jboss server for this application, but I want to run both server and application from application,any suggestions?
tomcat:run runs a web application in an embedded tomcat instance ... useful for testing during development.
See http://mojo.codehaus.org/tomcat-maven-plugin/run-mojo.html for listing of config parameters for the run goal, including warSourceDirectory which, if not specified defaults to ${basedir}/src/main/webapp
I'm not sure exactly why but we use the mvn cargo:start plugin instead, for testing locally when building with maven. We also utilize Spring and haven't had any issues regarding the mix. When starting up the Tomcat container with the command above it shows the following in the console
C:\SVN\myproject-war\target\tomcat6x\home>
This contains the webapps folder where the war is deployed and a logs folder.
Hope this helps, sorry I don't have direct experience with the tomcat-maven-plugin itself.
If I understand your question correctly, from your application you want to start tomcat to serve a spring MVC application.
If so, you do not need maven or a maven plugin to do this. You can use tomcat catalina APIs to achieve this. Though dated, this article explains how.
As the other answers stated, maven's tomcat and cargo plugins allow you to start and stop tomcat from maven - typically to run some integration tests.