I am trying to convert my current application into maven. I am separating the code into different modules.
Its a web application which has
Controller package
Model package
services packages
DAO packages
mybatis package which has interface to interact with database
WEB-INF Folder which contains all jsps inside /jsp folder
I created different modules I created a core module which right now has
service package
DAO Package
src/main/webapp/WEB-INF
I created Model module which has all model classes and I am able to compile it successfully.
Now I am trying to compile mybatis package which is giving me error
/home/.../mybatis/db/mybatis/dao/usersmapper.java :[7,54] error:
package com.mycom.myproject.mybatis.db.mybatis.model does not exist
as usersmapper.class already been created with model module.
So I am not getting what I am doing wrong.
My main pom.xml is
<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.myproject</groupId>
<artifactId>mainapp</artifactId>
<version>1.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>mainapp</name>
<properties>
<spring.version>3.1.1.RELEASE</spring.version>
</properties>
<dependencies>
<!--Joda time -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time-jsptags</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-config</artifactId>
<version>${spring.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<modules>
<module>model</module>
<module>core</module>
<module>mybatis</module>
</modules>
and my model pom is which I am able to compile
<?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">
<parent>
<artifactId>mainapp</artifactId>
<groupId>com.myproject</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.myproject</groupId>
<artifactId>model</artifactId>
<packaging>jar</packaging>
<name>model</name>
and my mybatis pom which I am not able to compile is
<?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">
<parent>
<artifactId>mainapp</artifactId>
<groupId>com.myproject</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>com.myproject</groupId>
<artifactId>mybatis</artifactId>
<packaging>jar</packaging>
<name>mybatis</name>
<dependencies>
<!-- mybaties -->
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>3.1.1</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.mybatis.generator</groupId>
<artifactId>mybatis-generator-core</artifactId>
<version>1.3.0</version>
</dependency>
</dependencies>
Please let me know if you need any more information.