Showing posts with label maven. Show all posts
Showing posts with label maven. Show all posts

Monday, 28 November 2016

Could not resolve archetype

Could not resolve archetype org.apache.maven.archetypes:maven-archetype-quickstart:RELEASE from any of the configured repositories.

Go to your Maven installation folder C:\apache-maven-3.1.0\conf\ ( For example: here we have installed maven in c:\ drive)
Copy settings.xml to C:\Users\[UserFolder]\.m2 (Your local repository)
Modify the proxy in settings.xml based on the info that you get from the above link.

or delete the repository folder from .m2 folder

and restart the eclipse with default maven setting

Ref : javahonk, Git



Tuesday, 23 August 2016

Please initialize the log4j system properly.

Eroor :

log4j:WARN No appenders could be found for logger (com.group.api.EmployeeService).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.

Solution :
1. In maven based. create log4j.properties file in folder /src/main/resources.
2. add following lines.

# Root logger option
log4j.rootLogger=DEBUG, stdout, file

# Redirect log messages to console
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n



Sunday, 21 August 2016

The ResourceConfig instance does not contain any root resource classes

When created a  maven web project.
1. Make sure to delete all the jsp file. 
2. Refresh and build

Method 2 :
1. In eclipse right click go to properties
2. Go ro java build path
3. Order and export
4. Add "JRE and system library","Maven library". and click ok
5. Right click on project
5.1 Go to run.
5.2 maven install.

Wednesday, 15 June 2016

creating a maven web project from commandline

1)
a. creating a maven project from commandline

mvn archetype:generate -DgroupId={project-packaging}
-DartifactId={project-name}
-DarchetypeArtifactId=maven-archetype-webapp
-DinteractiveMode=false

ref : maven

b) need to create sample web application

ex : mvn archetype:generate -DarchetypeGroupId=com.sample.voice -DarchetypeArtifactId=maven-archetype-webapp -DarchetypeVersion= voice


mvn archetype:generate -DgroupId=com.voice -DartifactId=sample -DarchetypeArtifactId=maven-archetype-webapp -DinteractiveMode=false

Sunday, 17 April 2016

Maven fails to parse POMs jenkins

Maven Failed to parse POMs jenkins
hudson.maven.MavenEmbedderException: 1 problem was encountered while building the effective settings
[FATAL] Non-readable settings /usr/../apache-maven/apache-maven-3.2.1/conf: /usr/../apache-maven/apache-maven-3.2.1/conf (Is a directory) @ /usr/../apache-maven/apache-maven-3.2.1/conf

Solution :

Go to jenkins homepage.

Go the project/job which was deployed.

Go to configuration -> build - > advance-

From the setting file dropdown -- > choose default maven setting option and save.

And build the jenkins job.

Friday, 15 April 2016

Install maven on redhat linux

Install maven on redhat  linux

wget : to retrieve content from server

REF : maven mirror

1) wget http://mirror.olnevhost.net/pub/apache/maven/binaries/apache-maven-3.2.1-bin.tar.gz

1.1)
create the apache-maven if not exist.
command :
sudo mkdir -m a=rwx /usr/local/apache-maven

1.2) Go to apache-maven directory and execute the command.
maven

1.3) extract the file
command : tar xvf apache-maven-3.2.1-bin.tar.gz

1.4) export the path
1.4.1) export M2_HOME=/usr/local/apache-maven/apache-maven-3.2.1
1.4.2)export M2=$M2_HOME/bin
1.4.3) export PATH=$M2:$PATH

1.5) verify maven version
mvn -version

output :

Maven home: /usr/local/apache-maven/apache-maven-3.2.1
Java version: 1.8.0_45, vendor
Java home: /usr/java/jdk1.8.0_45/jre
Default locale:
OS name: "linux",

REF : 1) stackoverflow
           2) linux

Thursday, 7 April 2016

Skipping Tests in maven

If you want to skip test of project enable the surefire plugin in pom.xml

configuration :

type : false - enables the test suite to run.
          true  - enables to skip the test.
command : mvn install -Dmaven.test.skip=true

pom.xml configuration :

<project>
  [...]
  <properties>
    <skipTests>true</skipTests>
  </properties>
  [...]
  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.12.4</version>
        <configuration>
          <skipTests>${skipTests}</skipTests>
        </configuration>
      </plugin>
    </plugins>
  </build>
  [...]
</project>
Ref : maven

Friday, 25 March 2016

Wednesday, 16 March 2016


Error :
Cannot find class [] for bean with name defined in ServletContext resource [/WEB-INF/spring/applicationContext.xml]

Hi this is the common error when working with maven peoject.

solution :

step 1. go to command prompt and do maven clean update ex : mvn clean install step 2 : reload the project in eclipse