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.
Related
I am using Maven to use Postrgres SQL driver. Besides I am using InteliJ IDEA Ultimatre Edition, and, as I understood, Maven is included in Ultimate version initially. Correct me - all I need, is to set dependencies, and connect PostrgeSQL to Java. I am not oblige to Download Maven (except required Dependecie of course, I mean Maven as framework)? Thanks a lot!
When you are creating a new project, choose Maven. After the project is created, you will receive an empty Maven project structure with the pom.xml and a script mvnw of Maven Wrapper, which you can use (instead of mvn) to build your app.
Just add dependencies to the pom.xml and build.
The Maven Wrapper will do the work for you - download Maven into the project subdirectory and use it.
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 keep getting this error when I try to compile my code. I have the pom.xml file in my directories but I am not sure if there is something wrong in there. I found only one link on the internet regarding this and that was not my case: Maven project configuration required for module
Error:Maven Resources Compiler: Maven project configuration required for module 'updater' isn't available. Compilation of Maven projects is supported only if external build is started from an IDE.
Here is the content of my pom file:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.nothing.updater</groupId>
<artifactId>Updater</artifactId>
<version>1.0-SNAPSHOT</version>
<!--<dependencies>-->
<!--<dependency>-->
<!--<groupId>com.nothing.toolbox</groupId>-->
<!--<artifactId>Toolbox</artifactId>-->
<!--<version>1.1</version>-->
<!--</dependency>-->
<!--</dependencies>-->
</project>
I am using a multi-module project.
Right-click on pom.xml and then click on "Add as Maven Project".
Right click the module and select the Make Module "project module name" option from the pop up menu. The messages will be shown. But go to Problems and see now. This will clear and correct this problem.
In my case the problem ocurred after uprgrading IJ from 14.x to 15.x and disappeared when I issued Build -> Rebuild Project
In case of IntelliJ , Right click on the POM.xml file of your project and click on the option "Add as Maven Project".
My problem with this error under 2019.3.4 is related to the build delegating to Maven. Idea is letting Maven build my project first and that build is failing because I broke a test. I get around this problem by not allowing IDEA to delegate to Maven. On Mac OS Catalina: Intellij -> Preferences -> Build, Execution, Deployment -> Build Tools -> Runner and uncheck Delegate IDE Build/run actions to Maven
The messages originates from Line 43 in /org/jetbrains/jps/maven/compiler/MavenResourcesBuilder.java, so my guess is that it is no pom.xml issue but rather IntelliJ Idea related.
If you dig further into the code, it looks for a file called maven/configuration.xml and from what I see, it searches in some temporary directory.
Maybe you should try and start your build as clean as possible.
Quick solution (IntelliJ IDEA):
Right-click on the project, the select Maven->Reimport
In my case, I had to use the following trick:
Right click the module name in the project panel
Select "Open Module Settings"
In the pop-up window, click Dependencies
Select java version 1.8.0_151
I have the same error after a Intellij Idea version upgrade (2016.3 to 2017.1):
Error:Maven Resources Compiler: Maven project configuration required
for module 'MODULE_NAKE' isn't available. Compilation of Maven
projects is supported only if external build is started from an IDE.
But my solution was another. Somehow, I think the Intellij lost the maven version used in my project. I was using maven 2.2.1 but Intellij was trying to use maven 3.x.
So, my solution was adjust this configuration in:
File > Settings > Build, Execution, Deployment > Build Tools > Maven
And set the maven version to 2.2.1.
I had this problem after an Intellij Idea version upgrade. The fix was to wait for it to finish indexing. Then I think it downloaded some stuff it needed.
Makes me think that the other answers on this thread about the IJ version upgrade probably just needed to wait as well - by the time they finished trying a few things the problem was fixed by itself.
In my case this was caused by a misconfiguration of IntelliJ. A long time ago I had been experimenting with the Lifecycle options within the Maven Projects view and had left a few phases in a sub module checked as Execute Before Build.
Because I had completely forgotten having checked these, it took me quite some time to understand the connection with the error messages in the Problems view. After unchecking the Execute Before Build switches of the affected phases everything went back to normal and particularly running unit tests became much faster.
In my case, I invalidated the cache and restarted the IDE. It worked, not sure why though.
I chose the bundled maven installation which helped me.
It could also be something to do with using a symlink to reference the maven installation..
it turns out the version of intelliJ I use (2018.3) can't import maven projects using apache-maven-3.6.2
modify .idea/compiler.xml,add config(should change module name to yourself):
In my case I got this error message, because my Maven configuration in IntelliJ was broken. I had entered invalid options into VM options for importer at Preferences:Build,Execution,Deployment->Build Tools->Maven->Importing.
After deleting these options IntelliJ started to behave normal again.
I am using IDEA with WSL2 and Windows10.
My problem occurred when IDEA automatically set the JDK in WSL2 as project JDK.
After Setting my JDK back to Windows JDK, the error disappearred.
In my case I had all configured to execute the hot reload with devtools after each file change namely:
File -> Settings -> Build, Execution, Deployment -> Compiler -> Enable "Build project automatically";
File -> Settings -> Advanced Settings -> Allow auto-make to start even if developed application is currently running.
The maven related error in the Auto-build tab was being displayed and only went away when I deleted .idea folder in the root directory, opened the project again, built the project without maven config (build as Ant project), and configured all again.
After the reset the error disappeared and the maven build was executed without errors.
I was troubled by this problem all afternoon,the solution in stackoverflow is not usefull for me.But I just solved this problem by accident,i don't kown how it worked,but it is effective.If you have the same project structure.
project structure
you can try this
try this button
and you will found all children project is build success. then you can run all project normally.
Go to event log and from there you will see options, what need to fix it
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.
How can I reference another workspace project using Eclipse m2e?
Do I have to add a project dependency in the project setting? But in that case the dependency is not shown in the pom.
If I set them in the pom, it will not reference the project in workspace but reference the jar in the local repository. Quite annoying, anyone can help?
The correct way to do this is the following:
Use the dependencies section in the POM file exclusively, don't fiddle with the Eclipse project references. Right-click the project, then select Maven > Update Project Configuration to reset the project to the Maven default settings. This way, m2e has ownership of the dependencies.
Make sure all referenced projects are open in Eclipse and have the Maven nature enabled.
Check the Maven settings for each project, make sure that groupId, artifactId and version match with the projects you have open in Eclipse. So if the project you depend on has version 1.0.0-SNAPSHOT in Eclipse, make sure that the depending project's POM file references version 1.0.0-SNAPSHOT in the dependencies section.
Enable Workspace Resolution for each of the projects. Right-click the project, then Maven > Enable Workspace Resolution.
Finally, if the projects are still not resolved, right-click the project again, then Maven > Update Project
This should solve your problem. If after this, your dependencies are still referenced from the file system, check the groupId, artifactId and especially version of each dependency again.
Also check if you don't have any errors in your project - try to run Maven install.
I'd go even further than this.
If you've ever run mvn eclipse:eclipse on your project then you're probably in trouble. I had a situation where I had both a "Referenced Libraries" section and a "Maven Dependencies" section in my eclipse project, with conflicting library versions, causing eclipse and myself inevitable confusion.
The safest thing I found was to run mvn eclipse:clean from the command line then go back in to eclipse, refresh the project, "OK" the resulting problem dialog, and then go Maven > Update Project. This sorted it all out for me.
When eclipse is messed up with importing and deleting several projects, you may need to rebuild index of maven repositories. Here is a way that I have done.
Check if an referenced project is recognized as a maven project by eclipse properly.
In menu bar, click Window -> Show View -> Other...
When 'Show View' window pops up, select Maven -> Maven Repositories
In Maven Repositories window, You should see your project as jar file in Local Repositories -> Workspace Projects
If you can not find your project in Workspace Projects, right click on Workspace Projects and select Rebuild Index.
Update maven of an referencing project
Right click on the referencing project, Maven -> Update Project... -> OK
You also need to make sure that you are running the correct goals.
If you don't run the install goal then it won't be copied to your repository and won't compile.
To learn more about goals have a look at https://maven.apache.org/guides/introduction/introduction-to-the-lifecycle.html
With kudos to #nwinkler's response, the main problem is matching the version number.
A common scenario is that if you are developing a set of projects that are version lock-steped with each other - for example, a project and a set of library projects that are not very loosely coupled, such that a library API might change in a version to be consumed by the relevant app project version, but may change in a way that is incompatible with a past or future version of the app project.
The correct way to set Maven dependencies in such a configuration (and it is also the recommended practice) is to have the app consume specific versions of the libraries - so, for example, if you rebuild an old version of the app, it will use the library version that it previously compiled with.
With the app project's POM library dependency set to a release version (lets say 1.0.0), and while working on the next release with both the app and library projects set to a SNAPSHOT release (lets say 2.0.0-SNAPSHOT), the m2e will not resolve the library version correctly, and will likely download an old version, so that trying to use Eclipse features like "Open Decleration" will target the download jar (sometimes without even a source attachment) which can be pretty annoying.
One way to work around that is to set the app POM dependency version to a range, so instead of depending on 1.0.0, you'd depend on [1.0.0-). With an open range like that, m2e will happily find your workspace library project. But you'd want to set it back to the "correct" version before committing, building and publishing - and this can be very error prone.
My solution is to use build profiles and set a custom profile for m2e, like this:
Set your dependency version with a property, to the version you want to publish against:
...
<properties>
<my.library.version>1.0.0</my.library.version>
</properties>
<dependencies>
<dependency>
<groupId>my.group</groupId>
<artifactId>my.library</artifactId>
<version>${my.library.version}</version>
</dependency>
</dependencies>
...
Then add a profile section with an active by default profile that does nothing, and an Eclipse-specific profile that overrides the library version property with a range:
...
<profiles>
<profile>
<id>default</id>
<activation><activeByDefault></activeByDefault></activation>
</profile>
<profile>
<id>eclipse</id>
<properties>
<my.library.version>[1,)</my.library.version>
</properties>
</profile>
</profiles>
...
Finally go to your project properties, and under "Maven" type "eclipse" into "Active Maven Profiles":
Then "Apply and close".
Eclipse m2e will then always see the version range and will resolve dependencies from the eclipse project (even if you have the library installed in the local Maven repo, as the Eclipse project will have a higher version number), but other builders will see the original, strict, version number.