Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

We have two different web application and we want to extend few controllers of one war into another war.

We are using maven to build the project.

to include war we have given its dependency as

<dependency>
            <groupId>com.abc.exchange</groupId>
            <artifactId>employer</artifactId>
            <version>2.3.M2-SNAPSHOT</version>
            <type>war</type>
            <scope>compile</scope>
        </dependency>

It is unable to build giving class not found exception.

Can any body help me out how to achieve this?

I am getting error maven build failed :

[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project agent-war: Compilation failure: Compilation failure:
[ERROR] projectsrunk_newagentsrcmainjavacomplatformagentwebAgentEmployeeController.java:[22,41] cannot find symbol
[ERROR] symbol  : class EmployeeController
[ERROR] location: package com..platform.employer.web
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
332 views
Welcome To Ask or Share your Answers For Others

1 Answer

You can define the war plugin to produce a separate jar file which is available via a classifier based on the configuration:

<configuration>
  ..
  <attachClasses>true</attachClasses>
  <archiveClasses>true</archiveClasses>
</configuration>

After that you can use this as a separate dependency in other projects. But the best to make a separate jar module out of it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...