java - Spring boot with maven for parent project -
i having spring boot maven project, name "csmaster", contains common code use in projects (appadmin).
csmaster project contains- common code domains, repository layer, service layer , pom.xml file.
appadmin project contains- controller layer, helper classes, jsp files , pom.xml file. in controller layer have autowired service layer present in master project.
now while writing code able access methods of parent project in appadmin project while generating war of appadmin project mvn install throwing following error-
[info] ------------------------------------------------------------------------ [info] build failure [info] ------------------------------------------------------------------------ [info] total time: 7.996 s [info] finished at: 2016-10-26t13:07:25+05:30 [info] final memory: 28m/280m [info] ------------------------------------------------------------------------ [error] failed execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project appadmin: compilation failure: compilation failure: [error] /home/ttnd/sumit/zzzlearning/repo/boot_appadmin/src/main/java/com/appadmin/helper/permgrouphelper.java:[10,27] package com.csmaster.domain not exist
it not picking master project classes while creating build.
my pom files are-
csmaster: pom.xml
<?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"> <modelversion>4.0.0</modelversion> <groupid>com.csmaster</groupid> <artifactid>csmaster</artifactid> <version>0.0.1-snapshot</version> <packaging>jar</packaging> <name>csmaster</name> <description>masterproject</description> <parent> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.4.1.release</version> <relativepath/> <!-- lookup parent repository --> </parent> <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <project.reporting.outputencoding>utf-8</project.reporting.outputencoding> <java.version>1.8</java.version> <hibernate.version>5.2.2.final</hibernate.version> </properties> <dependencies> <!-- spring --> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-web</artifactid> </dependency> . . . . . </dependencies> <build> <plugins> <plugin> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-maven-plugin</artifactid> </plugin> </plugins> </build> </project>
appadmin: pom.xml
<?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"> <modelversion>4.0.0</modelversion> <groupid>com.appadmin</groupid> <artifactid>appadmin</artifactid> <version>0.0.1-snapshot</version> <packaging>war</packaging> <name>appadmin</name> <description>appadmin</description> <parent> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.4.1.release</version> <relativepath /> <!-- lookup parent repository --> </parent> <properties> <project.build.sourceencoding>utf-8</project.build.sourceencoding> <project.reporting.outputencoding>utf-8</project.reporting.outputencoding> <java.version>1.8</java.version> <hibernate.version>5.2.2.final</hibernate.version> </properties> <dependencies> <!-- parent jar --> <dependency> <groupid>com.csmaster</groupid> <artifactid>csmaster</artifactid> <version>0.0.1-snapshot</version> <scope>runtime</scope> </dependency> <!-- spring --> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-web</artifactid> </dependency> . . . . . </dependencies> <build> <plugins> <plugin> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-maven-plugin</artifactid> </plugin> </plugins> </build> </project>
how can fix it..???
your csmaster dependency runtime , per maven introduction guide;
runtime:
this scope indicates dependency not required compilation, execution. in runtime , test classpaths, not compile classpath.
change dependency declaration scope runtime compile below;
<dependency> <groupid>com.csmaster</groupid> <artifactid>csmaster</artifactid> <version>0.0.1-snapshot</version> <scope>compile</scope> </dependency>
Comments
Post a Comment