0

What I want to do is to change two existing classes in a project (project A). These classes are of type .class. I want to use maven shade in another project (project B) to point out these classes in project A, do some modification to them, and send them back to the project (project A).

How can I do this?

So far I've created a project (B) and added the maven shade plugin to the pom file and have tried to point out the classes I want to change. Do not know if this is the right way to do this.

This is my pom file:

   <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>logic-rexster</groupId>
   <artifactId>logic-rexster</artifactId>
  <version>0.0.1-SNAPSHOT</version>
 <build>
<sourceDirectory>src</sourceDirectory>
<plugins>
  <plugin>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
      <source>1.7</source>
      <target>1.7</target>
    </configuration>
  </plugin>
  <plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-shade-plugin</artifactId>
    <version>2.3</version>
        <executions>
                <execution>
                    <phase>package</phase>
                    <goals>
                        <goal>shade</goal>
                    </goals>
                    <configuration>
                        <artifactSet>
                            <includes>
                                <include>com.tinkerpop.rexster:rexster-server:*:*</include>
                            </includes>
                        </artifactSet>
                                  <filters>
                    <filter>
                        <artifact>rexster-server:rexster-server</artifact>
                        <includes>
                            <!-- These classes will be taken directly from dependency JAR -->
                            <include>/rexster-server/com/tinkerpop/rexster/server/RexsterApplicationProvider.class</include>
                            <include>/rexster-server/com/tinkerpop/rexster/filter/AbstractSecurityFilter.class</include>
                        </includes>
                    </filter>
                </filters>
                  <transformers>
                    <transformer implementation=
                      "org.apache.maven.plugins.shade.resource.IncludeResourceTransformer">
                      <resource>LogicRexsterApplicationProvider</resource>
                      <file>RexsterApplicationProvider</file>
                    </transformer>
                  </transformers>
                    </configuration>
                </execution>
            </executions>
  </plugin>
</plugins>
    </build>
    <dependencies>
     <dependency>
       <groupId>com.tinkerpop.rexster</groupId>
       <artifactId>rexster-server</artifactId>
       <version>2.4.0</version>
   </dependency>

   </dependencies>
   </project>

Regarding the modification I want to do: I want to modify the RexsterApplicationProvider.class class. to copy some stuff from the AbstractSecurityFilter.class class

[UPDATE] I've added the two classes that I want to alter to my new project (B)'s src folder. (These classes have been decompiled before I added them here.)

Where do I go from here?

agiledevpro
  • 133
  • 1
  • 5
  • 17

0 Answers0