如何使用来自另一场战争的类文件 [英] how to use class file from another war

查看:114
本文介绍了如何使用来自另一场战争的类文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们有两个不同的Web应用程序,我们希望将一个战争的控制器扩展到另一个战争。

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

我们正在使用maven来构建项目。

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?

我收到错误maven build failed:

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] \projects\trunk_new\agent\src\main\java\com\platform\agent\web\AgentEmployeeController.java:[22,41] cannot find symbol
[ERROR] symbol  : class EmployeeController
[ERROR] location: package com..platform.employer.web


推荐答案

您可以定义war插件以生成单独的jar文件,该文件可通过基于配置

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>

之后,您可以将其用作其他项目中的单独依赖项。但是最好从它中制作一个单独的jar模块。

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.

这篇关于如何使用来自另一场战争的类文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆