I have a parent pom in my company that defines "uber-jars". It was
using the assembly plugin, but I have switched it to use the shade
plugin, so we can combine the spring related files
(META-INF/spring.handlers and META-INF/spring.schemas).

The shade plugin is only used when a profile is active, in this case
"production".

Here is the relevant parts of the pom:

  <profiles>
    <profile>
      <id>production</id>
      <activation>
        <property>
          <name>production</name>
        </property>
      </activation>
        <plugins>
          <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-shade-plugin</artifactId>
            <executions>
              <execution>
                <phase>package</phase>
                <goals>
                  <goal>shade</goal>
                </goals>
                <configuration>
                  <transformers>
                    <transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                      <resource>META-INF/spring.handlers</resource>
                    </transformer>
                    <transformer
implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
                      <resource>META-INF/spring.schemas</resource>
                    </transformer>
                  </transformers>
                </configuration>
              </execution>
            </executions>
          </plugin>
        </plugins>
      </build>
    </profile>
  </profiles>

Due to other parent pom inclusions, when I go to do a mvn:release on
this pom, the production profile is active. I get the following error
in the output:

INFO] [shade:shade {execution: default}]
[ERROR] The project main artifact does not exist. This could have the following
[ERROR] reasons:
[ERROR] - You have invoked the goal directly from the command line. This is not
[ERROR]   supported. Please add the goal to the default lifecycle via an
[ERROR]   <execution> element in your POM and use "mvn package" to have it run.
[ERROR] - You have bound the goal to a lifecycle phase before "package". Please
[ERROR]   remove this binding from your POM such that the goal will be run in
[ERROR]   the proper phase.
[INFO] ------------------------------------------------------------------------
[ERROR] BUILD ERROR
[INFO] ------------------------------------------------------------------------
[INFO] Failed to create shaded artifact.

I understand the need for this error on a pom which produces no
artifact to be shaded. But in this case, this parent pom has its
packaging set to pom, so no jar is created. I don't want to set the
packaging to jar, which goes against what a parent pom should be.

Any help is appreciated. I've done a few searches, and so far turned up nothing.

-- Larry

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to