UTopup.1.0.jar file Missing. Java, eclipse, Maven - java

Problem 1 -I am using Eclipse Indigo with maven for J2EE development with Apache Tomcat. My problem is that i am able to clean project , but unable to execute mvn install. the screen shot shows the error message. It has the 4.6.1-RC01-SNAPSHOT but couldn't resolve to dependency. The other file UTopup.1.0.jar it says is missing, i searched this file on web and other team member's PC to have it in the directory, but no one has this jar file and they are running the project perfectly. The question is what is this file and from where do i get one?
Problem 2 : I got the project from SVNRepository and the project came to me without proper packaging, it shows the hierarchy but not the packages, any idea why is that so, Please help...

The other file UTopup.1.0.jar it says is missing, i searched this file on web and other team member's PC to have it in the directory, but no one has this jar file and they are running the project perfectly. The question is what is this file and from where do i get one?
Not sure about this jar myself, but can you try to remove your local repository once and and then re-attempt to mvn install the project?
Problem 2 : I got the project from SVNRepository and the project came to me without proper packaging, it shows the hierarchy but not the packages
I am not sure what you mean by proper packaging, do you mean to say that eclipse isn't displaying the project in a proper structure ( like the src/main/java etc etc ). If that is the case, then simply the eclipse settings file for this particular project isn't committed on the svn. Its just a matter of setting up your classpath file so that eclipse can display the folders properly.

Related

Does creating a folder in default maven directory structure offered by eclipse lead to any issues?

I've recently started learning Spring REST. As part of my learning process, I developed a simple Hello World application using Maven. The directory structure of maven offered by Eclipse doesn't contain the "
java" folder in src/main. So, I added it explicitly. It turns out the application gives me a 404 error as you can see in the below image. I'm sure this has something to do with the class path. As I'm new to maven I don't understand the concept of the classpath.
But in the second image, I created the project using "co.ntier" (maven archetype for Spring MVC). The directory structure of this archetype has got the java folder which is why when I run the application I'm able to get the output.
How to add or configure maven so that every time I create a new maven project, the directory structure will have the java folder? Please help me.
I recommend to always create a Maven project from an archetype.
You can e.g. use the quickstart archetype for a simple project.
The presence of a "java" folder has nothing to do with whether an application can successfully serve something at a particular url. They are not directly related. This also has nothing to do with the classpath.
However, the red mark on the project indicates an error, and as the DEFAULT location for compilable source in a Maven project is "src/main/java", it seems clear that the lack of the "java" folder results in the project not being deployed, which IS why you get a 404.
In short, if you have red marks in the project, it's not going to deploy.

Project is missing required library [Eclipse]

I have imported a java project into a new eclipse workspace and it gave me a lot of errors:
It says "Project 'myProject' is missing required library: /User/linus/.m2/..." (The directory is longer but not of interest for you)
Now, I have looked inside my Finder to see what is in ".m2" but there is no such directory where it should be. Additionally I let it show all the hidden files but no success. Lastly I tried to get into the folder with the terminal (using cd and then the directory eclipse gave me) but that did not work either.
I saw this post but it did not help me.
I reinstalled Maven to make sure it can be used, this is the output if I type mvn --version and mvn in the terminal:
Does anyone have an idea?
Thanks in advance
EDIT:
I reinstalled Maven and now there is a /.m2 folder. It contains /.m2/repository/ but there is nothing in it...
May I suggest you read a Maven tutorial like http://maven.apache.org/guides/getting-started/maven-in-five-minutes.html
IMHO it's a wonderful build tool because it gets required jar files per the specification in the project object model ("pom") file which your Maven-ized project should have, and you don't have to keep track of jars on your own.
Look in your project for pom.xml, you might even post it here.
To check the sanity of the project and maven on your computer (ignoring Eclipse for a moment), be sure you have a good Internet connection, open a Terminal window, change directory ("cd") over to the project directory, and type "mvn install".
This should trigger the usual Maven build cycle. One of the first things it should do is download all the jars as identified in the pom.xml and store them deeply nested within your /Users/linus/.m2/ directory. Then it should compile all your java classes. Eventually it will probably build a jar file and copy it to somewhere.
If all this works, visit http://eclipse.org/m2e/ for directions to add the Maven plugin (m2e) to your Eclipse. Then your Eclipse should understand how to download jars and build the project per the pom.xml file.
Eventually this all should fix the original "Project is missing required library" problem.

Import and use a Maven managed Java library (CitySDK)

I am trying to build a web application based on the project library CitySDK, but i don't know how to import it properly into my own project.
I have created a Maven Web Application and added the CitySDK library as a Dependency, and then Selected the Project, right-clicked and Selected Build with Dependencies. No errors appeared, and in the image below you can see it appeared as a dependency.
However, whenever i try to use some of the classes specific to it, in my own Web Application(called TourismApplication's TestClass.java), the compiler displays an error, that the package is unknown. Could anyone suggest ideas as to what i have missed? I have followed a few Maven tutorials, but without any effects.
The dependencies are as follows:
Ok I did some digging and I think I figured out your problem. Their POM file is incorrect based on the structure of project.
First off, I'll paraphrase what I think the steps you took to get it built in your project were, to ensure I followed the same steps to get it working. These are the steps I took:
Cloned/downloaded the sources from the link you placed in the OP
Built the project into a jar file by running the command they said to use: mvn clean package assembly:single
Installed the artifact in your local Maven repo using mvn install
Added a dependency in your project POM
I tried the same thing you did, using the library in a test source file, to no avail. I looked at the .jar file that was built using their instructions and didn't find any .class files archived into it... it was essentially empty.
Turns out, their src folder structure follows Maven standards, but their POM file indicates the sources are down a different chain of directories. If you examine the build log closely, you see "[INFO] No sources to compile"
The POM.xml file they provide specifies the source directory as
<sourceDirectory>src/citysdk/tourism/client</sourceDirectory>
However, the actual files are at
src\main\java\citysdk\tourism\client
After changing the line in the POM file from the above to (similarly for tests):
<sourceDirectory>src/main/java/citysdk/tourism/client</sourceDirectory>
<testSourceDirectory>src/test/java/citysdk/tourism/client/tests</testSourceDirectory>
rebuilt, and installed, it worked when I tried to use it in my project. Hope this helps.
FYI, I used IntelliJ as my IDE, but it should work the same with Eclipse.

How to transfer my Eclipse Maven Selenium Webdriver TestNG Java project from one PC to another?

I am working at a place, but sometimes I bring some work home.
The problem is, however I try to export my project from my work computer and use it on my home computer, I get all kinds of errors, missing files and so on.
Is there a way to transfer the project flawlessly?
What kind of additional information should I provide?
I've tried exporting to a JAR. Importing fails
I've tried moving the whole project folder, and opening an existing Maven project - fails.
Just remove the class path file. Zip the entire folder and take it. Ensure when importing into your other eclipse import it as a maven project and not as just a simple java project. Your class path file contains all the path of the src and jar folders. since the path will be different in your other system you will get such errors.

Eclipse IDE behaves weirdly

I am getting a class not found exception for my Login Controller when I try to login to my application(It is a spring MVC Application). Before running the maven clean command the Application was running perfectly, I used maven clean and then again done a build using maven package command, suddenly it stopped working. I tried restarting the TomCat, re-deployed the application on TomCat, restarted the Eclipse IDE but nothing has worked so far.
Why this happens and what is the possible solution to this ??
Are you trying to run your project under Eclipse?
And does it generate source files?
If these are both true, you probably need to update the project config (select project or pom, right-click, Maven..Update..Project Configuration and Maven..Update..Project Dependencies).
The problem is that when Maven does a clean, it gets rid of the generated directories, which Eclipse observes and removes from your Build Path. But then when Maven rebuilds the directories, Eclipse doesn't notice it - you have to give it a hint.
Check your project for build errors and build path errors.
Make sure you've defined an M2_REPO classpath variable in Eclipse (Preferences - Java - Build Path - Classpath Variables).
If you're using the m2eclipe plugin, right-click your project and click on Maven - Update project configuration. That will configure an Eclipse build path for your project based on your pom dependencies.
If you're not using m2eclipse, execute mvn eclipse:clean eclipse:eclipse in your project folder. Then refresh your project in Eclipse.
What you haven't said is that you've checked and the missing class is in fact present.
A quick way to check is in the code editor SHIFT+CTRL+T and type the name of the missing class. Eclipse should not only show you the class if it exists, on highlighting the class, Eclipse should tell you which jar it is in.
Based on the info you have provided, I would say some dependecy in your POM has been removed by mistake or you need a newer version of some jar. If you find the class is not present, then you can figure out which jar you need by googling something like Maven 2 MyMissingClass jar that usually works for me.
Delete the .metadata folder in your eclipse workspace and then again open the workspace and import the required project.
This will solve your problem.
In .metadata folder it maintains the temporary copy of the project.
what worked in my case was simply removing the project from work space and importing it back again.
But I still don't know why it worked Vs why other things mentioned did not work (I tried updating dependencies in fact I removed all the dependencies from pom.xml and added everything again)

Categories