1

The class files I want to add are given as a library, and I don't have the source codes.

I tried put them in WEB-INF/classes but it doesn't seem to work in my eclipse maven environment.

If possible, I want the class files left as they are, without packaging them into jar or something.

Thanks in advance.

hotohoto
  • 490
  • 8
  • 20

1 Answers1

1

I think your best bet is described here. This idea is to create an in-project repository. Do this:

  1. Package the class files into a jar. Choose an artifactid and version like so: my-classes-1.0.0.jar

  2. Place the jar like so {project.dir}/libs/my-groupid/my-classes/1.0.0/my-classes-1.0.0.jar (the groupid and artifactid and version can be anything you like).

Add the in-project repository to your pom like so (name and id can be anything):

<!– In Project repository –>
<repository>
  <id>in-project</id>
  <name>In Project Repo</name>
  <url>file://${project.basedir}/libs</url>
</repository>

Reference the classes like any other dependency:

<dependency>
    <groupId>my-groupid</groupId>
    <artifactId>my-classes</artifactId>
    <version>1.0.0</version>
</dependency>
Andrew Eisenberg
  • 28,387
  • 9
  • 92
  • 148