Gary

Somehow your message went into my spam folder.

The idea was in synapse there were certain utility classes which other
modules should only use while writing integration tests with synapse. The
test classes are not expected to be used in non-test code by other modules.

synapse also contains test classes to check its code which is not that
relevant for other modules. So I was trying to exclude those codes in the
test-jar.

Since maven --also-make is not working properly with test-jar. I can create
a separate synapse-testing-utility jar which synapse and other modules can
use in their test scope for testing. I think that is what you were
suggesting.

Thanks,


On Fri, Mar 22, 2024 at 4:15 PM Gary Gregory <garydgreg...@gmail.com> wrote:

> I think the "simple" solution is to use 2 maven modules, then you don't
> need to do anything special. The layout does not make sense to me so I must
> be missing something. If the common code is needed for both main and test,
> then it should be in main. You can put that common code in its own package
> to signal its specific purpose.
>
> Gary
>
>
> On Fri, Mar 22, 2024, 3:29 AM Debraj Manna <subharaj.ma...@gmail.com>
> wrote:
>
> > I have a Maven module named synapse.
> >
> > main
> >   java
> >     package1
> >       A.java
> >
> > test
> >   java
> >     common
> >       C.java
> >     package1
> >       ATest.java
> >
> > Can someone let me know if in Maven I can create a non-executable jar
> > containing all non-test code (main/) and another test-jar containing only
> > the code under the package test/java/common?
> >
> > I tried the below
> >
> > <build>
> >   <plugins>
> >        <plugin>
> >         <groupId>org.springframework.boot</groupId>
> >         <artifactId>spring-boot-maven-plugin</artifactId>
> >         <configuration>
> >           <skip>true</skip>
> >         </configuration>
> >        </plugin>
> >        <plugin>
> >          <groupId>org.apache.maven.plugins</groupId>
> >          <artifactId>maven-jar-plugin</artifactId>
> >          <version>3.3.0</version>
> >          <configuration>
> >           <includes>
> >             <include>common/**</include>
> >           </includes>
> >         </configuration>
> >         <executions>
> >           <execution>
> >             <goals>
> >               <goal>test-jar</goal>
> >             </goals>
> >           </execution>
> >         </executions>
> >       </plugin>
> >      </plugin>
> >   </plugins></build>
> >
> > I am observing that the test-jar is getting created as expected
> containing
> > only the code from test/java/common but the non-executable, non-test jar
> > does not contain the code from main/java/package1.
> >
> >    - Maven Version - 3.8.4
> >    - Java 17
> >
>

Reply via email to