Kevin Meredith
Kevin Meredith

Reputation: 41939

Building a Maven Project with Class Files

My Maven project uses a forked JAR of spring-security-oauth.

I'd like to add extra debugging statements, so I unzipped the spring-security-oauth-custom.jar.

But, when I navigated to the org/springframework/security/oauth/common/signature directory, I saw class files.

How can I use the source files instead since I can't modify the class files?

Upvotes: 0

Views: 145

Answers (2)

Isaac
Isaac

Reputation: 16736

Artifacts in Maven are immutable. Assuming you let Maven grab spring-security-oauth-custom.jar from a Maven repository, you can't just edit the contents of the JAR file and expect things to work.

You'll have to do the following:

  1. Download the source bundle for spring-security-oauth-custom.jar.
  2. Expand the sources somewhere.
  3. Make your modifications.
  4. Create a new artifact out of this new module (including creating a new POM file for it, giving it unique Maven coordinations such as groupId, artifactId and version).
  5. Install the new artifact in your own artifact repository.
  6. Adjust your calling module (that is, the module calling spring-security-oauth-custom) to depend on your modified version, instead of the original.

Upvotes: 5

NilsH
NilsH

Reputation: 13831

To use a custom built JAR file like that you should deploy it in your local repository and use it as a regular dependency. You can either put it in your repository manually, or you can use the maven-install-plugin. Either way, you should create a unique version number for it so it does not "collide" with any official Spring artifacts.

Upvotes: 1

Related Questions