Re: How to include only certain test packages in a maven test-jar & all non test code in a non test jar?

2024-03-22 Thread Stanimir Stamenkov

See my reply below the quote...

Fri, 22 Mar 2024, /Debraj Manna/:


[...]
I tried the below


   

 org.springframework.boot
 spring-boot-maven-plugin
 
   true
 


  org.apache.maven.plugins
  maven-jar-plugin
  3.3.0
  
   
 common/**
   
 
 
   
 
   test-jar
 
   
 
   
  
   

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.


The easiest way is probably what Gary Gregory has suggested – extract 
the common code in its own module.


Your main JAR is likely missing classes as you've applied  
configuration globally to the maven-jar-plugin, and not just to the 
"test-jar" execution:



  

  test-jar


  
common/**
  

  


You may wish to give the execution a non-default ID, and produce 
additional JAR with a different classifier:



  
common-test-jar

  test-jar


  tests-common
  
common/**
  

  


You'll then use the given classifier when specifying this JAR as a test 
dependency to other modules.


See also: "How to create an additional attached jar artifact from the 
project" 



--
Stanimir

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



Re: How to include only certain test packages in a maven test-jar & all non test code in a non test jar?

2024-03-22 Thread Gary Gregory
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  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
>
> 
>   
>
> org.springframework.boot
> spring-boot-maven-plugin
> 
>   true
> 
>
>
>  org.apache.maven.plugins
>  maven-jar-plugin
>  3.3.0
>  
>   
> common/**
>   
> 
> 
>   
> 
>   test-jar
> 
>   
> 
>   
>  
>   
>
> 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
>


Re: [DISCUSS] Maven Dependency Plugin

2024-03-22 Thread Alexander Kriegisch
I most frequently use tree and analyze, but have used others like the copy* and 
unpack* goals, too.

I do miss an equivalent to tree for plugin dependencies.

-- 
Alexander Kriegisch
https://scrum-master.de


Tamás Cservenák schrieb am 21.03.2024 17:04 (GMT +01:00):

> I'd would be interested in how users and devs are using
> maven-dependency-plugin:
> https://maven.apache.org/plugins/maven-dependency-plugin/
> 
> I collected some basic questions I'd like to have answered (but feel free
> to add more info!):
> - which goals are "must have" for you
> - which goals are "I never touched" for you (or, "I really don't need" or
> "never used" or "shrug")
> - what is missing?

-
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org



How to include only certain test packages in a maven test-jar & all non test code in a non test jar?

2024-03-22 Thread Debraj Manna
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


  
   
org.springframework.boot
spring-boot-maven-plugin

  true

   
   
 org.apache.maven.plugins
 maven-jar-plugin
 3.3.0
 
  
common/**
  


  

  test-jar

  

  
 
  

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