Thank you very much, Alexander! It solved the issue!

Toshiya

On Thu, Mar 28, 2024 at 4:53 PM Alexander Kriegisch <
alexan...@kriegisch.name> wrote:

> Shade needs an original sources JAR as input for 'createSourcesJar'. Make
> sure to add Maven Source Plugin to your build and put it above Shade in the
> 'plugins' section to ensure that both of them are exeuted in the correct
> order during the 'package' phase.
>
> <plugin>
>   <groupId>org.apache.maven.plugins</groupId>
>   <artifactId>maven-source-plugin</artifactId>
>   <version>3.3.0</version>
>   <executions>
>     <execution>
>       <id>module-source-jar</id>
>       <goals>
>         <goal>jar</goal>
>       </goals>
>     </execution>
>   </executions>
> </plugin>
>
> BTW, in a multi-module project, the requirement to create source JARs
> applies to all modules the aggregate JAR depends on and is meant to shade.
> Alternatively, you could use Maven Assembly to first create one aggregate
> sources JAR and then let Shade find that one.
> --
> Alexander Kriegisch
> https://scrum-master.de
>
>
> Toshiya Kobayashi schrieb am 28.03.2024 06:22 (GMT +01:00):
>
> > Hello,
> >
> > I use maven-shade-plugin to create an uber jar and its source jar with
> > <createSourcesJar>.
> >
> > https://github.com/tkobayas/shade-test/blob/main/pom.xml
> > ```
> >       <plugin>
> >         <groupId>org.apache.maven.plugins</groupId>
> >         <artifactId>maven-shade-plugin</artifactId>
> >         <version>3.5.2</version>
> >         <executions>
> >           <execution>
> >             <id>source-jar</id>
> >             <goals>
> >               <goal>shade</goal>
> >             </goals>
> >             <configuration>
> >               <createSourcesJar>true</createSourcesJar>
> >               <artifactSet>
> >                 <includes>
> >                   <include>org.ow2.asm:asm</include>
> >                 </includes>
> >               </artifactSet>
> >             </configuration>
> >           </execution>
> >         </executions>
> >       </plugin>
> > ```
> >
> > The uber jar (shade-test-1.0-SNAPSHOT.jar) contains both the project
> > classes (App.class) and dependency classes (org.ow2.asm:asm), but the
> > source jar (shade-test-1.0-SNAPSHOT-sources.jar) contains only
> > dependency class sources, not the project class sources (App.java).
> >
> > Is it expected? Am I overlooking any configuration?
> >
> > Any help/suggestions would be appreciated.
> >
> > Thanks!
> > Toshiya
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
> For additional commands, e-mail: users-h...@maven.apache.org
>
>

Reply via email to