Generate a pom.xml file using App Engine and Maven - java

I'm using Google App Engine for Eclipse and also Git.
First I've created my "helloworld" project with Eclipse and GAE plugin
Then I've created a repository that I've cloned on my Google server machine.
Only problem is my project don't have any pom.xml and I think that's making bug the whole process when I enter $ mvn appengine:run.
Is there a way to create a pom.xml file with mvn CLI? Do you think that's the only problem I have.
Here is my error log:
[ERROR] No plugin found for prefix 'appengine' in the current project
and in the plugin groups [org.apache.maven.plugins, org.codehaus.mo
jo] available from the repositories [local
(/home/Jsmith/.m2/repository), central
(https://repo.maven.apache.org/maven2)] -> [He lp 1]
Help is greatly appreciated.

Eclipse allows to convert a project to maven, try
right click on the project name > Configure > Convert to Maven Project

You can create a Maven project (including the POM) from a template called Archetype in Maven terminology:
In short, Archetype is a Maven project templating toolkit. An archetype is defined as an original pattern or model from which all other things of the same kind are made. The name fits as we are trying to provide a system that provides a consistent means of generating Maven projects.

Related

How to create an archetype for my java maven project and upload it into GitHub artifact?

I developed a java maven project and published it to the GitHub. I'm using GitHub actions as ci/cd pipeline. Now I want to create an archetype of this project and publish it to the GitHub artifact, so that all other people in my team could use this archetype as base one whenever they are creating a java maven project. Generally we use mvn archetype: create-from-project to create an archetype. But I'm not getting the desired outcome. How can I achieve this? Anyone help me.
Thankyou.

Using TFS Artifacts as a Maven Dependency

I have 2 Maven projects , a library and an App ,
Both are built and stored as an Artifacts in TFS (2017)
I would like to import project A directly from the TFS Artifacts into Project B
But apparently the structure the TFS artifacts are kept and the fact they do not keep the POM.XML prevents the Project B maven file to indentify the TFS Artifactory as a Maven artifactory and import the Library .
My question is .
1) Is it even possible to use TFS Artifacts the same way Maven artifacts are used ?
2) How does it done?
Thanks in advance
make sure Project A is deployed correctly to your Maven repository (instead or in addition to the deployment to TFS - I would have kept in TFS only the sources...). Then it would be very simple for maven to find project A and add it to B as a dependency.
Hope that helps.
You can try to publish the Artifacts of Project A to a shared folder (Artifact Type: File Share), then reference it directly or add a copy task to copy the artifacts to Project B.
Besides, it sounds like the chain builds in TFS. You can try the extension: Trigger Build Task, the task that can be used to trigger a new Build so that build-chaining is possible. Supports as well conditional triggers. See below similar thread for details:
How to chain builds in TFS 2015?
Using personal library .jar in TFS Online build
Another workaround is upgrading to TFS 2018 or migrating to VSTS to install a Maven artifact is as a dependency of another artifact with the Maven CLI.
Please see Install Maven artifacts using VSTS and TFS for details.
Related documents:
Set up the Maven client in VSTS and TFS
Publish Maven artifacts using VSTS and TFS
Build your Java app with Maven

What is the difference between Maven build and Maven build... in Eclipse?

I am new to eclipse and programming , so probably a silly question.
According to me build just makes jar file but maven install deploys it to local repo thats m2 .
Also there are two options for build ->maven build and-> maven build..
Could u explain me the explain mw the difference between two.
maven build... lets you specify goal and various other build parameter (build profile, offline, update snapshot, other build parameter etc..)
maven build is a pre-defined goal that eclipse maven plugin wraps under,
You could see the first couple line of output for both of the case
Build - Maven phase - compile and prepare ready to distribute package - eg. JAR
Build... - opens eclipse wizzard where you can customize the build
Install - Maven phase - do the same as with Build and install to local artifact (product of Build phase) to local or remote repository. This will allow to use that project as dependency in other projects.

Travis CI not using extra Maven repository provided in pom.xml

I have a Java-based GitHub project, fitnessjiffy-spring (I'm currently focused on the "bootstrap" branch). It depends on a library built from another GitHib project, fitnessjiff-etl. I am trying to configure both of these to be built by Travis CI.
Unfortunately, Travis is not as sophisticated as Jenkins or Hudson in dealing with Maven-based Java projects. Jenkins can easily handle dependencies between projects, but the same concept doesn't seem to exist with Travis. If one project depends on another, then that other project must already be built previously... and its artifact uploaded to some Maven repo where the first project can download it later.
My "fitnessjiffy-etl" library is building and deploying just fine. I'm using Bintray for Maven repository hosting, and you can clearly see my artifacts over plain HTTP at:
http://dl.bintray.com/steve-perkins/maven/
In my "fitnessjiffy-spring" project, I am adding this Maven repo location directly in the pom.xml, so that Travis will be able to find that artifact dependency. Here is the state of my POM at the time of this writing. Note the <repositories> element at the bottom of the file.
When I build this project locally, it works just fine. I can see it downloading the Maven artifact from "http://dl.bintray.com/...". However, when I try to build on Travis CI it fails every time. I can see in the console log that Travis is still trying to download the artifact from Maven Central rather than my specified repo.
Does this make sense to anyone else? Why does Maven utilize a custom repository location in a POM file when building locally, but ignores this configuration when running on a Travis CI build?
From digging into this further, I discovered that Travis uses its own proxy for Maven Central, and has configured Maven to force ALL dependency requests through their proxy. In other words, it does not seem possible at this time to use additional Maven repos specified in the POM file of a project built on Travis.
In my case, I ended up refactoring such that project would not need the outside JAR dependency. I also switched to Drone.io, so I could manage my settings on the build server rather than having to carry a YAML file in my repository (which always struck me as a bit daft).
However, even on Drone it's still a major hassle to manage dependencies between multiple projects (extremely common with Java development). For Java, I just don't think there's currently an adequate substitute for Jenkins or Hudson, maybe running on a cheap Digital Ocean droplet or some other VPS provider instance.
In your install phase add a $HOME/.m2/settings.xml define your custom repository.
cache:
directories:
- "$HOME/.m2"
install:
- curl -o $HOME/.m2/settings.xml
https://raw.githubusercontent.com/trajano/trajano/master/src/site/resources/settings.xml
- mvn dependency:go-offline
script:
- mvn clean install site

How to use Maven with EAR

If i want to convert an EAR project a maven project , do i need to add the module in the deployment assembly as maven dependency or just use the convert in m2eclipse without any further configuration.
Me personally I wouldn't attempt any kind of conversion of an existing project. I would add the poms, make sure that mvn clean install works on the command prompt and then create a new mavenized Eclipse project from the poms.
The main reason is that you current project settings are effectively wrong when you switch to Maven - the Maven poms are the truth and what feeds the Eclipse project setup, so you really do not want to make your life difficult and work against m2eclipse - let it do the project creation for you. Fresh.
You can install m2eclipse and then do the following as well.
Go to the project menu (right click on Package Explorer) > Configure > Convert to Maven Project
Open the pom.xml and right-click and choose Run As -> Maven Clean. Similarly Choose Run As -> Maven Install.
Note : Please ensure that your eclipse project settings are correct and classpath libraries are not absolute and you don't have any project specific environment variables defined in your workspace. Please take a backup of your project before you do this.This is to ensure we don't mess up the current stable project configurations. Once m2eclipse generates the pom.xml for your project, you can update and make changes to it to
fully obtain a mavenized ear build. hope this helps
You can also try creating new maven project with archetype selection of "jboss-javaee6-ear" and follow the similar structure for your project. Most probably you will need parent Pom and child poms per each module (ejb, war, jar etc). There are other few similar approach but almost all of them requires you to have mulitple POMs
maven-ear-plugin and JBoss AS 7
You can also go through all the examples for maven ear plugin to find settings suitable for you
http://maven.apache.org/plugins/maven-ear-plugin/
I ended up ditching ear for war :) single POM and even ditched the JBOss for tomcat/jetty :)
If you want to convert your existing eclipse dependencies into Maven dependencies, you can try the JBoss Tools (JBT) Maven integration feature, which contains an experimental conversion wizard, plugged into m2e's conversion process : http://docs.jboss.org/tools/whatsnew/maven/maven-news-4.0.0.Beta1.html.
So, all you have to do is, as Keerthi explained, right-click on your project and Configure > Convert to Maven...
If your dependencies already are maven artifacts, it should work easily. If not, you'll need to convert them to Maven (if they're workspace projects) or make them available in your maven enterprise repository, before converting the EAR project.
JBT (requires Eclipse JavaEE) can be installed from http://download.jboss.org/jbosstools/updates/stable/kepler/ or from the Eclipse Marketplace (See https://marketplace.eclipse.org/search/site/jboss%2520tools)

Categories

Resources