On Sat, 17 Jul 2021 at 15:59, Alex Herbert <alex.d.herb...@gmail.com> wrote:

>
>
> On Sat, 17 Jul 2021 at 14:17, Gilles Sadowski <gillese...@gmail.com>
> wrote:
>
>> Hi.
>>
>> Le mer. 14 juil. 2021 à 13:02, Alex Herbert <alex.d.herb...@gmail.com> a
>> écrit :
>> >
>> >>> [...]
>> > > > Anyway the summary is that using 'mvn site' should not be expected
>> to run
>> > > > all the validation checks on the code. It is to build documentation.
>> > >
>> > > Makes sense (and we were doing it wrong before).
>> > >
>> > > > If you want to check the code then use 'mvn verify'.
>>
>> Command
>>   $ JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64/ mvn clean verify test
>> site
>> currently results in the build failing:
>> ---CUT---
>> [ERROR] Failed to execute goal
>> org.apache.maven.plugins:maven-shade-plugin:3.1.1:shade (default) on
>> project examples-sofm: Error creating shaded jar:
>>
>> /home/gilles/devel/java/apache/commons-math/trunk/commons-math-neuralnet/target/classes
>> (Is a directory) -> [Help 1]
>> ---CUT---
>>
>> Any idea?
>>
>
> This works for me (have JAVA_HOME already set):
>
> mvn -v
>
> *Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)*
>
> Maven home: /usr/local/apache-maven-3.6.3
>
> Java version: 1.8.0_241, vendor: Oracle Corporation, runtime:
> /Library/Java/JavaVirtualMachines/jdk1.8.0_241.jdk/Contents/Home/jre
>
> Default locale: en_US, platform encoding: UTF-8
>
> OS name: "mac os x", version: "10.16", arch: "x86_64", family: "mac"
>
> cd commons-math-examples/
>
> touch site-content
>
> touch chinese-rings/site-content
>
> touch tsp/site-content
>
> mvn clean verify test site
>
>
>
Building from the project root I get the same error you reported.

This post of StackOverflow [1] indicates that this is a problem with
running the shade plugin within a multi-phase command. It is related to
dependency resolution when the shade plugin tried to incorporate all the
classes in the final jar. If building all the classes it the same phase
then it appears to break. If left to download them (as in my first example)
then it works.

I suggest the shaded jar is added within a profile and not on the default
build. Thus you need to explicitly build the shaded jar.

Is it the intention to release this artifact? Otherwise build on-demand via
a profile should solve this.

Alex


[1]
https://stackoverflow.com/questions/37942689/maven-shade-plugin-reports-error-creating-shaded-jar-target-classes-is-a-d

Reply via email to