I'm new to programming (and web development) and thought it would be good practice to try and build the sample Google App Engine project through Google's tutorial.
Here are my notes, spanning vim/command line weirdness/other fun stuff -http://goo.gl/EfZ3Gm
For reference, I am using OS X Yosemite 10.10.3 (beta)
I started here - https://cloud.google.com/appengine/docs/java/gettingstarted/introduction
and followed all the command line instructions for Steps 1-3. I have Maven 3.2.5 installed, here is the output from my command prompt when I type 'mvn -v'
Apache Maven 3.2.5 (12a6b3acb947671f09b81f49094c53f426d8cea1; 2014-12-14T12:29:23-05:00)
Maven home: /usr/local/Cellar/maven/3.2.5/libexec
Java version: 1.7.0_75, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.7.0_75.jdk/Contents/Home/jre
When I reach Step 4, I'd like to open the project in Eclipse, since I'm a bit more comfortable with looking at the code in an IDE.
Looking at the project's pom.xml file in the 'Overview' tab, I see the error -
Plugin execution not covered by lifecycle configuration: org.codehaus.mojo:versions-maven-plugin:2.1:display-plugin-updates (execution: default, phase: compile)
Looking at the code, I would guess it's because the maven referenced in the project doesn't match what I have installed on my machine? I see similar questions have been asked previously -
Plugin execution not covered by lifecycle configuration
Plugin error: execution not covered by lifecycle configuration
Plugin execution not covered by lifecycle configuration
But running 'mvn eclipse:eclipse' in my terminal window would negate all the work I did in Steps 1-3 with maven in the command prompt; I needed maven for these steps. And the second option involves installing Spring IDE - there has to be a better way than this, I hope!
When using eclipse with the m2e plugin (which is included standard and enables maven in eclipse), it will attempt to run plugins in your pom file as part of build for any maven enabled project.
For it to know what to do it uses an m2e-connector - there needs to be one for each plugin, installed into eclipse.
If it can't find one, it issues this error/warning.
If you press cmd-1 on the troublesome line, it will give you a few options. They boil down to 'ignore this'. One will modify your pom file to include a maven plugin which controls the configuration of eclipse, or add a clause to it if already present. The other saves the 'ignore this' configuration into eclipse settings.
This should remove the warning/error, and make no difference to your development environment.
In the case that this plugin is crucial, you'll need to locate an m2e-connector. They generally don't exist - so you'd probably be out of luck. In this case, it just spits out a report telling you if there are any more recent versions of dependencies available and has no impact on your build, so don't worry about it.
I strongly advise against using mvn eclipse:eclipse, especially with appengine apps. It won't use the correct library setup for your app to run properly.
Related
I am trying to use maven to build a JNI project and I am running into some difficulty creating a GA release. The project's native code needs to be compiled on at least 3 systems (Linux, OSX, Windows) due to the native code requirements. I would also like GitHub Actions to produce a release build when I create a tag on GitHub. Because of this, I am facing a number of issues with the maven release plugin. It seems like maven's release process involves compiling and testing the code as well as screwing around with SCM before I can create a GA version and release. This simply isn't possible for this JNI project. I have already gone down the cross compiler route with Ant and I would really like to move away from that for any number of reasons, mostly Apple related. I also thought about releasing each JNI target individually, but I would really like to bundle the native code inside of the JAR and things start getting complicated when I need to share a .m2 folder across different build environments. Is it possible to release a maven project without all the compiling, testing and SCM nonsense? Maybe a different 3rd party plugin? Is there a better way I should be doing this? For reference, the pom can be found here.
Dont use the release plugin, I had a lot more success with the maven version plugin.
All the maven release plugin is doing is taking the version off the snapshot, creating a new commit and then upping the version to a new incremented SNAPSHOT. You can mimic this process without maven needing to know anything about your SCM using versions.
One way to do it is to not SNAPSHOTS and instead build with the git short hash as part of the version:
So while developing, the version looks pretty normal
<groupId>org.example</groupId>
<artifactId>my-app</artifactId>
<version>1.1.0</version>
The do a "release" build based on a tag. My flow was
commit and push
build - mvn clean install, results in my-app-1.1.0.jar
deploy to a test env and run regression tests, if they succeed, we tag the commit with a "passed_tests" tag
CI fires on tags that match "passed_tests" - this needed to be the same commit that resulted in the jar under test
runs mvn -f ./pom.xml versions:set -DnewVersion=${gitProps['git.build.version']}_${gitProps['git.commit.id.abbrev']}
On the disk, our maven version is now:
<groupId>org.example</groupId>
<artifactId>my-app</artifactId>
<version>1.1.0-abcdef</version>
then runs mvn deploy. This is the artifact that gets deployed to the repo and now we have a jar file (or whatever) that has a version matching the git commit.
You could use the same process for all your target architectures.
I have a java application written in 2007-2010 that I need to build and run.
I am unable to open it in netbeans or eclipse.
Some identifying features of the source code:
It has a maven.xml and project.xml file (not pom.xml) in root
It has a jndi.properties, launch.properties and project.properties file in root
it has a .project and .jupiter file in the root directory
It is currently running in prod in a Jboss container
Are these indicators of some application framework from the late 2000s that someone can identify?
I am hoping to be able to open it in an IDE and build it.
It's a Maven 1 architecture.
[project.xml] Project Object Model (POM) definition
[maven.xml] Custom build scripts
[project.properties] general build settings
[build.properties] local build settings
Here you can see some more information and how to migrate it to Maven 2: Maven 1 to Maven 2
And here is some information on Maven's website about Maven 1: Quick start to Maven 1
Notice that it isn't supported anymore.
.project possibly indicates it's been built with Eclipse
.jupiter probably indicates that they used the code reviewer plugin Jupiter
All that said, I believe you could import it as an Eclipse project. Just pay attention on which Java version to use and which Eclipse and Maven as well.
I'd strongly recommend you to migrate to a newer version of Maven, but I also know how legacy software can be impacted by such migration, so it's up to you which way to go through.
I'm reading this: https://cloud.google.com/java/getting-started/using-forms
and i'd like to import this project in Eclipse from 0, but i'm getting a lot of errors. (Generally any GAE projects).
What are the steps to do this?
Create new Java project, run Maven (?) and so on...
I need to use Mars 2 and have installed jdk 1.7 and 1.8.
THX.
(PS: It works using the guide. So i can run the app on cmd)
Update: errors after AndrĂ¡s Kerekes'solutions
Try to follow these steps:
git clone the whole Getting Started Java repository
run mvn eclipse:eclipse in the top level directory of the cloned repository
import the projects into Eclipse (including the one at the top level: the project is called getting-started-java, you should see it in the Project Explorer) using File > Import... > Maven > Existing Maven Projects
You may see an error dialog about Maven errors, in the Action field, click on the cell and select to option to install the m2e connector for the JDT compiler. This will install a plugin into your Eclipse to bridge M2Eclipse and the JDT, you'll need to restart Eclipse once it finishes.
You may still see Maven errors like Plugin execution not covered by lifecycle configuration: org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (execution: default-compile, phase: compile), which is OK. You dependencies should be set for the project and there should be no compilation error.
Ensure that the project uses JDK8 as it depends on classes that are only available since Java 8 (like java.util.function.Function)
You may want to install the Cloud Tools for Eclipse plugin for additional GAE support.
I want to study the java spring portion of the Jbehave-tutorial project at https://github.com/jbehave/jbehave-tutorial.
The README.MD states the REQUIREMENTS for building at the bottom:
Building the tutorial has been tested with Maven 3.0.5-3.2.1 and JDK 1.6-1.7. Newer versions of Maven and JDK should work but could also present issues.If you find any, please report them via JIRA
On my computer My Computer I am running Maven Version: 3.3.3 and STS Version: 3.6.4 for 64-bit Windows 7.
I really don't want to make an Atlassian account in order to resolve this issue if I can resolve it on StackOverflow.
So these are the steps I took to build JBehave-tutorial on my machine:
git clone https://github.com/jbehave/jbehave-tutorial.git
mvn clean install -Pstable # Issued in the main parent folder 'jbehave-tutorial'
Imported into Spring Tool Suite (STS) as an existing maven project.
Received the following errors in STS:
This lead me to believe that maven did not correctly download and build those dependencies so I looked into the .m2\repository\org\jbehave folder and this is what I seen.
Did anybody else get this to work?
What workarounds are there?
What correct maven dependencies to specify for JBehave tutorial project in pom.xml(s)?
I'm not immediately clear on your specific situation but here are dependencies required to use JBehave without Spring. (example pom below - you'll only need gherkin if your user scenarios are in gherkin).
https://stackoverflow.com/questions/30685909/jbehave-dependencies-not-available-in-central-maven-repo
I'm also going to hazard a guess that you're going to need the below at the appropriate version.
<dependency>
<groupId>org.jbehave</groupId>
<artifactId>jbehave-spring</artifactId>
<version>4.0.3</version>
</dependency>
Maven cannot find "SNAPSHOT" dependencies.
You need to google "Maven + dependency name without specified version" and check what is the latest version of them and make appropriate changes in pom file.
For example I have jbehave-web-runner version 3.6-beta-2 NOT 3.6-SNAPSHOT.
I have the same problem like on the below link , and solution from there works
but i have a little of hard time in understanding what it cause this and how it affects the project.
Plugin execution not covered by lifecycle configuration (JBossas 7 EAR archetype)
I start reading about m2e
http://wiki.eclipse.org/M2E_plugin_execution_not_covered
What is the difference between the 'eclipse build' and maven one ?
Still not clear what is meant by "interesting" and "not-interesting" mojo executions:
https://docs.sonatype.org/display/M2ECLIPSE/Project+build+lifecycle+mapping
So there is the solution but , not the understanding of the problem.
Thanks for helping me understand the problem ...:)
Generally speaking, The way m2e used for resolving/mapping plugins' goal execution into Eclipse build life cycle has been reinvented after version 0.12. Now m2e requires explicit instructions what to do with all Maven plugins bound to "interesting" phases of a project build lifecycle. By either configure the lifecycle mapping in your project's pom, or use specific m2e configurator Eclipse plugin if somebody has kindly created it for the community.
By "interesting" they mean phases which normally occur during writing and debuging of code inside the IDE, mostly excluding packaging and deployment steps.
Also note (from this blog post):
M2E allows you to run Maven manually. You can invoke a goal like "mvn install" from within Eclipse just as you would do it from the command line. That works (and always worked) just fine. Unfortunately, Maven is also invoked automagically from M2E whenever Eclipse builds the project, for example after a clean. In such cases M2E acts as an "Eclipse Builder". It is these latter invocations that people have always had problems with and that the connectors should handle better.