Q1- During project Creation or Maven Update or if Pom.xml showing any error or dependecy jar not loading then-
Solution: Go to User Profile Foler =>.m2=>delete .lastupate.
if you unable to find User Profile folder then follow below steps-
1-Open folder by running this text (without Quotes) in Search Explorer of Window “%USERPROFILE%.m2”.
2-After running above command, “m2” folder of maven will open. Now search for file (without Quotes) “*.lastUpdated”.
3-In this step, delete all the files found by running Step 2.
4-Now go to Eclipse project and select “Maven | Update Dependency” or “Maven | Update Project”
5-If you still facing error then close eclipse and delete .m2 folder and try again.
-----------------------------------------------------------------------------------------
Q2- Could not transfer artifact org.apache.maven.plugins:maven-surefire-plugin:pom:2.7.1 from/to central
or
ArtifactTransferException: Could not transfer artifact
or
How to create settings.xml
Solution: Create settings.xml file in User Profile Foler =>.m2 folder. ( if you are unable to fine user profile folder then see Q1 (above).
To create settings.xml file-> open notepad-> paste below code-> save as-> File Name- settings.xml. Save As Type- All and Save.
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
https://maven.apache.org/xsd/settings-1.0.0.xsd">
<localRepository>${user.home}/.m2/repository</localRepository>
<interactiveMode>true</interactiveMode>
<offline>false</offline>
</settings>
---------------------------------------------------------------------------------
Q3- tomcat:deploy: “Cannot invoke Tomcat manager: Connection refused”
Solution: Before deploying of project make sure following-
For tomcat7 or tomcat 8 do the following-
1- Project- pom.xml
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://localhost:8080/manager/text</url>
<path>/projectName</path>
<username>tomcat</username>
<password>tomcat</password>
</configuration>
</plugin>
2- TomcatDirectory\conf\ tomcat-users.xml: Add below line in section
<role rolename="manager-gui"/>
<role rolename="manager-status"/>
<role rolename="manager-script"/>
<role rolename="manager-jmx"/>
<user username="tomcat" password="tomcat" roles="manger-gui,manager-status,manager-script,manager-jmx"/>
it will show like this-
Now run project and deploy it (Right Click on project=>Run as=>Run Configuration)
Gole:- clean install tomcat7:deploy (For first time deployment) and for next time use clean install tomcat7:redeploy.
Profile:-Leave Blank
Gole:-Default or path (if you have created settings.xml)