Rule of thumb: in a react build, don't ever use any lifecycle phase prior
to package, and if you want to skip tests, use -DskipTests or
-Dmaven.test.skip. Corollary: stick with "package" and "verify" (I consider
"mvn install" is an anti-pattern).
BTW, as another rule of thumb, use "processClasses" rather than "compile".
If you have users that want to do otherwise, i.e. "mvn processClasses" or
"mvn compile" (or even "mvn test") in a reactor build, then tell them you
rule/assumption, and let them come in with the workaround ;-)

In your specific case though, maybe you should do the unpacking at a later
stage, e.g. prepare-package ?

On Sun, Mar 24, 2019 at 11:51 AM Christofer Dutz <[email protected]>
wrote:

> Hi Maxim,
>
> unfortunately that doesn't help.
> The problem is that if we do a "mvn compile" no archiving (jar/war
> building) is done at all ...
> Guess what we would need, would be profiles based on the last maven phase
> being built.
> So if:
> - "last phase < package" --> Copy the content without unpacking (as the
> File reference returned by dependency resolution references the
> target/classes directory)
> - "last phase > package" --> Unpack the content (as the File reference
> returned by dependency resolution references a Jar/war file)
>
> Chris
>
>
> Am 22.03.19, 15:02 schrieb "Maxim Solodovnik" <[email protected]>:
>
>     Hello Chris,
>
>     Maybe <archiveClasses>true</archiveClasses> of maven-war-plugin
>     can help?
>
>     On Fri, 22 Mar 2019 at 20:12, Christofer Dutz <
> [email protected]>
>     wrote:
>
>     > Hi,
>     >
>     > we are currently having a little problem with our build.
>     > A user complained about not being able to build with a “mvn compile”.
>     > The reason is that we have one module that builds a web-client
> (bundled as
>     > war) and a server module to which the client is copied.
>     > We are using the maven-dependency-plugin:unpack to unpack the
> artifact
>     > into the server war. This works fine as long as we built to at least
> the
>     > “package” phase.
>     > If the user builds to something before that, the build fails as the
>     > pointer to the client pints to a directory instead of an archive.
>     >
>     > Is there a way to do some sort of “unpack-or-copy” that copies if
> it’s
>     > just a pre-package phase and does the normal unpack if the archives
> have
>     > been created.
>     >
>     > Would be happy to not tell them “just don’t do a `mvn compile` but at
>     > least a `mvn package`.
>     >
>     >
>     > Chris
>     >
>
>
>     --
>     WBR
>     Maxim aka solomax
>
>
>

Reply via email to