I am facing below issues while executing a project in Eclipse:
Publishing failed with multiple errors
File not found: D:\Programs\j2ee\OnlineLibrary\target\m2e-wtp\web-resources\META-INF\maven\OnlineLibrary\OnlineLibrary\pom.properties.
D:\Programs\j2ee\OnlineLibrary\target\m2e-wtp\web-resources\META-INF\maven\OnlineLibrary\OnlineLibrary\pom.properties (The system cannot find the path specified)
File not found: D:\Programs\j2ee\OnlineLibrary\target\m2e-wtp\web-resources\META-INF\maven\OnlineLibrary\OnlineLibrary\pom.xml.
D:\Programs\j2ee\OnlineLibrary\target\m2e-wtp\web-resources\META-INF\maven\OnlineLibrary\OnlineLibrary\pom.xml (The system cannot find the path specified)
System Configuration:
OS: Windows 8.1 (64-bit)
Tomcat: 8.0.30 (64-bit)
Java: jdk 1.8.0_45 (64-bit)
Maven version: 3.3.9 on C:/
Eclipse: Luna 4.4.2
Steps followed:
Configure maven in eclipse
Updated the settings.xml file with custom repositories path placed on C:\apache-maven-3.3.9\conf
In Eclipse:
Click Project-->Preferences-->Maven. Selected the artifacts download options
Click Maven-->Installations. Added the maven installation (C:\apache-maven-3.3.9) and set it as default
Click Maven-->Templates. Below mention Templates are in "Off" mode
"m2e profile","m2e-wtp activation,"m2e-wtp JAX-RS activation","m2e-wtp JPA activation","m2e-wtp JSF activation",
"m2e-wtp's specific context root property".
Click Maven-->User Settings. Global Setting, Local Settings points to C:\apache-maven-3.3.9\conf\settings.xml
Local Repository points to custom repositories path as below:
D:\Programs\Maven\Maven_Repositories
Created a new dynamic web project (project name: OnlineLibrary). Renamed the src folder as per Maven project structure.
Right clicked on project -->Configure-->Convert to Maven Project. Right click on the project-->Maven. Selected Resolve
dependency from workspace projects.
Added required dependencies to the project.
Project Build successful as per Maven clean, build, install process.
But when I try to execute/Run the project on server error is displayed:
This does not explain the problem but i resolved same problem with Maven->Update Project(s)
Go to "Servers" tab and start server first. Make sure this is same server which your project is using. If server is not already added then add new server.
Now run you project, it will ask for server to "Continue" to "Restart Server". Choose "Continue" and it should run fine. It worked for me.
Related
Using Eclipse Photon, importing a project created elsewhere. There are no errors in the edit window when I load the source code.
I get this error when I click Run:
Exception in thread "main" java.lang.UnsupportedClassVersionError: myPackage/Bookstore has been compiled by a more recent version of the Java Runtime (class file version 54.0), this version of the Java Runtime only recognizes class file versions up to 52.0
I reconfigured the build path to use my Workspace default JRE, which is 1.8.0_181, and I deleted the bin folder but the error persists.
I was selecting the Workspace Default JRE : that didn't fix the problem. I tried selecting the Execution Environment JRE and that worked. Here are the steps. It's Eclipse Photon but that should be similar to other recent versions. Here's a video that illustrates the steps: https://youtu.be/IE2B2e90kCs
Open Eclipse, verify your project is loaded in the Project Explorer
Right-click on the project in Project Explorer
Select Build Path
Select Configure Build Path
Click on Libraries Tab
If there is a system library, remove it
Click on the Add Library Button
Select JRE System Library
Click Next
Under System Library: Select "Execution Environment"
Click Finish
Click Apply and Close
I have been using maven in eclipse (with m2e) just fine, until recently when I renamed one of the folders on my hard drive where maven is installed.
The folder was renamed from Computer local to ComputerLocal
After renaming the folder I received the following error in eclipse when I attempted to do a maven build:
Can't find Maven installation C:\Computer local\apache-maven-3.0.4
Which of course makes perfect sense.
The problem is that when I re-named the folder on the installation directory path back to it's original name I kept receiving the same error as before:
Can't find Maven installation C:\Computer local\apache-maven-3.0.4
When I copy-past the directory path from the error into a explorer window it finds the directory just fine.
So what I'd really like to know is where can I find the configuration in eclipse where I can see path to the maven installation that is being used? Perhaps from there I can re-set it or re-configure it?
"Can't find Maven installation EMBEDDED" means it is that you are facing the issue with your eclipse version.
You just need to restart the and Check your eclipse settings
Windows-->Preferences-->Maven-->Installations
You can find the Embedded version of Maven.
This can be done by selecting your project and setting up with few goals in "Runtime Configurations" and few settings for Java and Environemnt Variables.
Right clicking on your parent POM file.
Select "Run As"-->"Maven Build"
In the Run Configurations window,
a) Enter project name, b) select your parent-project, c) provide some goals eg., clean install
Choose your External Maven from the dropdown. If you can not find your External Maven (other than embedded maven), Clicking on Configure and click on Add button and add your maven home location folder.
Setup your environmental variables with variable M2_HOME to your maven home location folder and also set PATH variable to %M2_HOME%\bin
In Eclipse, goto Window-> Preference -> Java -> Installed JREs -> Edit and pass VM Arguments as -Dmaven.multiModuleProjectDirectory=M2_HOME for windows and -Dmaven.multiModuleProjectDirectory=$M2_HOME for Linux and Mac OS X.
For versions Maven 3.x, and above, the variable can also be named as $MAVEN_HOME.
-Dmaven.multiModuleProjectDirectory=MAVEN_HOME for Windows
-Dmaven.multiModuleProjectDirectory=$MAVEN_HOME for Linux and Mac OS X
However, It is better to use M2_HOME as it supports for both Maven 2 and 3.
I have Eclipse Indigo 3.7 base with MyEclipse 10 Java enterprise development plug-in:
I have installed Sonar plug-in for eclipse.
Installed Sonar server and running it locally from localhost (localhost:9000)
Tested the Server connection in Eclipse from
Windows>Preferences>Sonar>Servers. Connection is successful.
For my Project, ran the Maven goal for sonar (sonar:sonar). Build is
successful. I am able to browse the results in localhost. (localhost:9000)
My issue is with Associating the project to Sonar.
When i right click on my project, Configure > Associate with Sonar, I get a screen where nothing happens.
Basically the screen has 2 fields,Project and Sonar Project.
The Project field contains the name of my Project and Sonar Project field lists this message - "click here to start searching for a remote Sonar project"
I click on that field and enter my groupid:artifactid but nothing
happens.
I also tried entering the Project Name listed in Sonar dashboard
but that also does not help.
When i right click on my project, In the context menu i am unable to see 'Sonar' option.
Help me associate my project to Sonar in eclipse. Please let me know what i am missing.
Thanks in advance.
I had the same issue with my Liferay project in Eclipse (liferay-plugins-sdk.6.2.0) and here is how I got it working:
Install the eclipse plugin, and test server connection
Install the Sonar server and start it (for example on yourhost:9000)
Go to yourhost:9000 and login (admin/admin unless you changed it)
Go to Settings -> System -> Provisioning
Create new project (+Create in the top right corner)
I've used key=Liferay6.2 and name=liferay-plugins-sdk-6.2.0
After the above steps I went back to my eclipse project and in Configure > Associate with Sonar I was able to search/find the liferay project.
When using Sonar Eclipse, you can associate Eclipse projects only to the corresponding Sonar modules (unless you are working on a single-module project, which is pretty rare in fact).
This means that you can't associate the root project (which is logical as by definition, a root project has no sources in Sonar). You have to right-click on all the imported Maven modules, and associate them all in a single run.
Go to your project folder in eclipse workspace from the terminal and run following command:
mvn sonar:sonar
This command will create your sonar project. Try associating the project again. Make sure you enter the name associated with your project from your
pom file. (Clear the text field)
BEST ANSWER AFTER SO MUCH ANALYSIS(I have faced the same problem)
Forget to add to associate with SonarQube first
If you want to add sonar group id create sonar-project.properties
Just add below code
# Required metadata
sonar.projectKey=javapractice
sonar.projectName=javapractice
sonar.projectVersion=1.0
# Comma-separated paths to directories with sources (required)
sonar.sources=src
# Language
sonar.language=java
# Encoding of the source files
sonar.sourceEncoding=UTF-8
download sonnar-runner from github.
download sonar example from github
download sonar
run sonar as per your operating system from command prompt
go to sonar example path like c:/sonar example/java/.. /.. *.properties path (beside src)
run sonnar-runner c:/.... / sonnar-runner.bat -e
go to browser http://localhost:9000 after that (login:admin/admin)
your project is displayed in the browser.
Choose Maven on the project and then choose Select Maven Profiles and then choose with-sonar in Eclipse. This will enable the Sonar functionality on projects. Now you will see the Sonar option when you right click on projects.
I have a maven web project that imported into eclipse. I have another maven project (generates a jar file) that the web project depends on.
Both of these projects work correctly when executed from the command line. mvn package creates a war file which pulls the jar it depends on from the maven repository for the web project. mvn package creates a valid jar file when run for the library.
When I import the library into Eclipse, m2e recognizes that the web project depends on the library and updates parts of the project to take advantage of the fact that both maven projects are hosted within a single Eclipse workspace. The "Maven Dependencies" section of the "Libraries" tab of the "Java Build Path" preference for the web project removes the library jar file and replaces it with the library project. As the library is updated in Eclipse, the web project recognizes those changes without having to install/deploy the library.
The problem occurs when I attempt to run the web application in Eclipse. Because Eclipse is actually building the Web project against the version of the library in Eclipse, it does not deploy the library file from the maven repository, it creates a new jar file that's a snapshot of the current version of the library in Eclipse. All of this has generally worked well for me, but on the project I'm currently working on there's a problem with the jar file that Eclipse is creating. Instead of inserting the class files for the library, it appears that it's taking the "src" directory of my Maven project and zipping it up as the jar file. The contents of the jar file look something like:
-main
-java
-com
-... *.java
-resources
-...
-test
-java
-com
-... *.java
Where I would expect it to look more like:
-com
-... *.class
Since I have successfully used this type of project before, I'm trying to figure out if there's something I need to configure or if I've just run into a bug.
I'm using the latest update of m2e (1.0.200.20111228-1245) on Eclipse Indigo (Build id: 20120216-1857).
In Eclipse, we can disable the "Workspace Resolution" so that it will use our dependencies directly from the local maven repository as the following steps: -
Disable Workspace Resolution
Right click at the project inside the eclipse
Select "Maven" from the context menu.
If it display "Disable Workspace Resolution" which means it is enable. We click it with purpose to disable it. Please note, after that it will display "Enable Workspace Resolution" which means we have disabled already.
We may need to update the project configuration and other related dependencies as the following steps: -
Update Project Configuration
Right click at the project inside the eclipse
Select "Maven" from the context menu.
Click the "Update Project Configuration..."
The "Update Maven Dependencies" windows will be displayed.
Select the required projects and click "OK".
Update Dependencies
Right click at the project inside the eclipse
Select "Maven" from the context menu.
Click the "*Update Dependencies"
The "Update Maven Dependencies" windows will be displayed.
Select the required projects and click "OK".
Please take a note, since we not use the related dependencies directly from the workspace anymore, It will use directly from our local maven repository. Then all related artifacts should be installed to our local maven repository by using the following command line.
mvn install
Anyhow it can be done by using the context menu inside the Eclipse as the following steps:-
Right click at the project inside the eclipse
Select "Run As" ---> "Maven Install".
Here's the solution that I came up with.
It appears that in my case the rules for the "Deployment Assembly" for the library project are still followed.
To change it go to the library properties->Deployment Assembly
In my case that just contained a mapping from '/src' -> '/'. I removed that entry and replaced it with a mapping from '/target/classes' -> '/' and '/src/main/resources' -> '/'.
Once I had that mapping in place, when the jar file was deployed it contained exactly what I had configured in the Deployment Assembly. That allows Eclipse to continue to be used without explicitly republishing the library for every change. But, it doesn't seem to auto redeploy to tomcat for me when the library is updated -- I still need to manually restart tomcat for library changes to be reflected.
It's still not entirely clear to me what's going on with this project. I do have previous projects that have a similar structure, and in those projects the Deployment Assembly has not been updated to explicitly include the class files and yet the proper jar file is still deployed.
I have a web app built with Maven.
Most of the time, I built the application using Intellij IDEA, but now I want to import the application in Eclipse to see something in this IDE.
After mvn eclipse:eclipse, I add in Eclipse the app, but when I try to add the app to the server (tomcat), I receive:
There are no resources that can be added or removed from the server
Solutions?
You need the project to have a Eclipse Dynamic Web Module facet. You can try doing this via the project properties dialog and looking at project facets, then clicking the appropriate check box. This may not be available however, so you may need to do the next thing.
Create a backup of your project and follow the directions at dzone.com. This'll allow you to modify the project facets via your eclipse .project file.
Keep in mind, once you add those facets, you cannot change them back via Eclipse. Definitely make sure you have a backup before starting.
This step worked for me:
Right-Click on the Project Name, then
Maven-->Update Project..
Click OK
After doing this I was able to see my project in Add/Remove Programs.
As mentioned somewhere else adding Eclipse WTP didn't do any good, however I performed the above step after I had already added Eclipse WTP, so I am guessing that may not be needed.
This was done for Eclipse Juno.
Hope this helps someone.
Edited: You can follow this link as above mentioned I think might have needed WTP and that add a lot of other things into the workspace.
http://blog.teamextension.com/maven-as-eclipse-dynamic-web-module-556
Check whether Maven Integration for Eclipse WTP is installed. If not, install it from Eclipse Marketplace
After installation restart Eclipse
Right click your project and Maven--> update project configuration
Delete tomcat and re create tomcat (clean tomcat,add your project,publish and enjoy)
I've got Tomcat 6, Java 1.6, and was trying to get it to work in Eclipse Juno Service Release 1's "internal server" (whatever that's called.) Here's what I did that worked for me:
(Found these instructions at http://www.mkyong.com/eclipse/eclipse-ide-tomcat-version-6-0-only-supports-j2ee-1-2-1-3-1-4-and-java-ee-5-web-modules/)
I should point out that I followed ClutchDude's instructions to make my project a Dynamic Web Module facet. It didn't work on its own for me, but maybe it was part of making it work in the end.
Using Eclipse (or other text editor), open the file
.settings/org.eclipse.wst.common.project.facet.core.xml
Find the line that reads
<installed facet="jst.web" version="3.0"/>
3.0 is for Tomcat 7.x (so says mkyong.) Change it to 2.5 (or 2.4).
I restarted Eclipse and it worked for my project.
The reason why this is happening is because eclipse by default looks for the deployment descriptor in the folder {project.home}/Webcontent/WEB-INF/web.xml where as the Maven puts them in src/main/webapp/WEB-INF/web.xml.
So when you are trying to add your project onto the server eclipse cannot find a deployment descriptor and hence you get the annoying message.
This can be solved by adding the following entries in .settings/org.eclipse.wst.common which can be found in
Project home folder in your workspace if it is a new maven project.
The folder where you already imported from if you are using Import -> Maven projects.
Make the following changes in to the org.eclipse.wst.common
wb-resource deploy-path="/" source-path="/src/main/webapp"/. Add this entry.
Edit --> property name="java-output-path"
Please check the following link from more details. http://java.dzone.com/articles/webapps-eclipse-and-maven.
The comments section has an excellent example with a working project.
This issue was fixed for me my installing additional eclipse modules. in particular, the ones related to m2e-wtp. just do a search for m2e in the plugins search listing for your version of eclipse
If you face an error like "There are no resources that can be added or removed from the server",
then
1) Go to the META_INF of your websvcsEAR and go to the application.xml.
2) Goto modules-> clickDetails and add the module that is existing. i.e., some EAR which your project demands.
3) Click ok
4) Now go to your server -> right click -> add and remove -> add your EAR.
Maybe you don't need add your application to the server's configuration. I think that you must use m2e eclipse plugin in order to launch the app.
For example, in your eclipse you will see a contextual menu called "Run as" if you right-click on your pom file. You can clicking on "Maven build" and Maven will download all the information needed to start tomcat.
I hope this helps you.
I used
mvn eclipse:eclipse -Dwtpversion=2.0
in command line in the folder where I had my pom.xml. Then I refreshed the project in eclipse IDE. After that I was able to add my project.
I was able to resolve this by removing my EAR project from my Eclipse workspace, then re-importing it.
Well, with a Spring and maven project, i got it that way:
Eclipse Version: 2019-06 (4.12.0)
Java 1.8
Tomcat 7
Yes, go to Project Properties >> Facets >> select Dynamic Web Module but dont apply yet!!!
Right under, it should appear a link Further Configuration Available. Click on it, otherwise one will have to edit .settings/org.eclipse.wst.common.component manually. Update source directory to src/main/java. (source)
Then in Facets window check Java - mine was pointing to 11 even though i don't have Java 11 installed or configured like a JRE runtime. I could only add/remove when changed to 1.8. (source). Note: That was really the problem, why don't Eclipse get this configuration automatically from the project?
Finally Eclipse creates some directories like WEB-INF and META-INF, just delete them.