Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions apache-maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ under the License.
<artifactId>maven-slf4j-provider</artifactId>
</dependency>
<dependency>
<groupId>org.fusesource.jansi</groupId>
<artifactId>jansi</artifactId>
<groupId>org.jline</groupId>
<artifactId>jline-terminal-ffm</artifactId>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down Expand Up @@ -139,13 +139,13 @@ under the License.
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>unpack-jansi-native</id>
<id>unpack-jline-native</id>
<goals>
<goal>unpack-dependencies</goal>
</goals>
<configuration>
<includeArtifactIds>jansi</includeArtifactIds>
<includes>org/fusesource/jansi/internal/native/Windows/**</includes>
<includeArtifactIds>jline-native</includeArtifactIds>
<includes>org/jline/nativ/**</includes>
</configuration>
</execution>
</executions>
Expand Down
2 changes: 1 addition & 1 deletion apache-maven/src/bin/mvn
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,6 @@ exec "$JAVACMD" \
-classpath "${CLASSWORLDS_JAR}" \
"-Dclassworlds.conf=${MAVEN_HOME}/bin/m2.conf" \
"-Dmaven.home=${MAVEN_HOME}" \
"-Dlibrary.jansi.path=${MAVEN_HOME}/lib/jansi-native" \
"-Dlibrary.jline.path=${MAVEN_HOME}/lib/jline-native" \
"-Dmaven.multiModuleProjectDirectory=${MAVEN_PROJECTBASEDIR}" \
${CLASSWORLDS_LAUNCHER} ${MAVEN_ARGS} "$@"
2 changes: 1 addition & 1 deletion apache-maven/src/bin/mvn.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ set "INTERNAL_MAVEN_OPTS=--enable-native-access=ALL-UNNAMED %INTERNAL_MAVEN_OPTS
-classpath %CLASSWORLDS_JAR% ^
"-Dclassworlds.conf=%MAVEN_HOME%\bin\m2.conf" ^
"-Dmaven.home=%MAVEN_HOME%" ^
"-Dlibrary.jansi.path=%MAVEN_HOME%\lib\jansi-native" ^
"-Dlibrary.jline.path=%MAVEN_HOME%\lib\jline-native" ^
"-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" ^
%CLASSWORLDS_LAUNCHER% %MAVEN_ARGS% %MAVEN_CMD_LINE_ARGS%
if ERRORLEVEL 1 goto error
Expand Down
8 changes: 0 additions & 8 deletions apache-maven/src/lib/jansi-native/README.txt

This file was deleted.

8 changes: 8 additions & 0 deletions apache-maven/src/lib/jline-native/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
This directory contains JLine native libraries extracted from JLine JAR.

You can add your own build for platforms not natively supported by JLine.
See here [1] on how to compile for your platform and here [2] how libraries
follow JLine's directory and filename conventions.

[1] https://github.com/jline/jline3/tree/master/native
[2] https://github.com/jline/jline3/blob/master/native/src/main/java/org/jline/nativ/OSInfo.java
2 changes: 2 additions & 0 deletions apache-maven/src/main/appended-resources/META-INF/LICENSE.vm
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ subject to the terms and conditions of the following licenses:
#* *##set ( $spdx = 'EPL-2.0' )
#* *##elseif ( $license.url.contains( "www.apache.org/licenses/LICENSE-2.0" ) )
#* *##set ( $spdx = 'Apache-2.0' )
#* *##elseif ( $license.name == "BSD-3-Clause" || $license.url.contains( "opensource.org/licenses/BSD-3-Clause" ) )
#* *##set ( $spdx = 'BSD-3-Clause' )
#* *##else
#* *### unrecognized license will require analysis to know obligations
#* *##set ( $spdx = 'unrecognized' )
Expand Down
28 changes: 28 additions & 0 deletions apache-maven/src/main/appended-resources/licenses/BSD-3-Clause.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
Copyright <YEAR> <COPYRIGHT HOLDER>

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:

1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
“AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
8 changes: 5 additions & 3 deletions apache-maven/src/main/assembly/component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,12 @@ under the License.
</includes>
</fileSet>
<fileSet>
<directory>target/dependency/org/fusesource/jansi/internal/native</directory>
<outputDirectory>lib/jansi-native</outputDirectory>
<directory>target/dependency/org/jline/nativ</directory>
<outputDirectory>lib/jline-native</outputDirectory>
<includes>
<include>**</include>
<include>**/*.so</include>
<include>**/*.jnilib</include>
<include>**/*.dll</include>
</includes>
</fileSet>
<fileSet>
Expand Down
4 changes: 0 additions & 4 deletions maven-core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,6 @@ under the License.
<groupId>org.apache.maven.resolver</groupId>
<artifactId>maven-resolver-util</artifactId>
</dependency>
<dependency>
<groupId>org.apache.maven.shared</groupId>
<artifactId>maven-shared-utils</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.sisu</groupId>
<artifactId>org.eclipse.sisu.plexus</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
*/
package org.apache.maven.lifecycle;

import org.apache.maven.message.MessageBuilder;
import org.apache.maven.message.MessageBuilderFactory;
import org.apache.maven.message.internal.DefaultMessageBuilderFactory;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.utils.logging.MessageBuilder;

import static org.apache.maven.shared.utils.logging.MessageUtils.buffer;

/**
* @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
Expand Down Expand Up @@ -57,16 +57,33 @@ public LifecycleExecutionException(String message, MojoExecution execution, Mave
this.project = project;
}

/**
* @deprecated Use {@link #LifecycleExecutionException(MessageBuilderFactory, MojoExecution, MavenProject, Throwable)}
* instead to allow for better message formatting.
*/
@Deprecated
public LifecycleExecutionException(MojoExecution execution, MavenProject project, Throwable cause) {
this(createMessage(execution, project, cause), execution, project, cause);
this(createMessage(new DefaultMessageBuilderFactory(), execution, project, cause), execution, project, cause);
}

public LifecycleExecutionException(
MessageBuilderFactory messageBuilderFactory,
MojoExecution execution,
MavenProject project,
Throwable cause) {
this(createMessage(messageBuilderFactory, execution, project, cause), execution, project, cause);
}

public MavenProject getProject() {
return project;
}

private static String createMessage(MojoExecution execution, MavenProject project, Throwable cause) {
MessageBuilder buffer = buffer(256);
private static String createMessage(
MessageBuilderFactory messageBuilderFactory,
MojoExecution execution,
MavenProject project,
Throwable cause) {
MessageBuilder buffer = messageBuilderFactory.builder(256);

buffer.a("Failed to execute goal");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,17 @@
import java.util.stream.Stream;

import org.apache.maven.lifecycle.MojoExecutionConfigurator;
import org.apache.maven.message.MessageBuilder;
import org.apache.maven.message.MessageBuilderFactory;
import org.apache.maven.model.Plugin;
import org.apache.maven.model.PluginExecution;
import org.apache.maven.plugin.MojoExecution;
import org.apache.maven.plugin.descriptor.MojoDescriptor;
import org.apache.maven.plugin.descriptor.Parameter;
import org.apache.maven.plugin.descriptor.PluginDescriptor;
import org.apache.maven.project.MavenProject;
import org.apache.maven.shared.utils.logging.MessageBuilder;
import org.apache.maven.shared.utils.logging.MessageUtils;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.component.annotations.Requirement;
import org.codehaus.plexus.util.StringUtils;
import org.codehaus.plexus.util.xml.Xpp3Dom;
import org.slf4j.Logger;
Expand All @@ -50,6 +51,9 @@
public class DefaultMojoExecutionConfigurator implements MojoExecutionConfigurator {
private final Logger logger = LoggerFactory.getLogger(getClass());

@Requirement
private MessageBuilderFactory messageBuilderFactory;

@Override
public void configure(MavenProject project, MojoExecution mojoExecution, boolean allowPluginLevelConfig) {
String g = mojoExecution.getPlugin().getGroupId();
Expand Down Expand Up @@ -142,7 +146,8 @@ private void checkUnknownMojoConfigurationParameters(MojoExecution mojoExecution
unknownParameters.stream()
.filter(parameterName -> isNotReportPluginsForMavenSite(parameterName, mojoExecution))
.forEach(name -> {
MessageBuilder messageBuilder = MessageUtils.buffer()
MessageBuilder messageBuilder = messageBuilderFactory
.builder()
.warning("Parameter '")
.warning(name)
.warning("' is unknown for plugin '")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.apache.maven.eventspy.internal.EventSpyDispatcher;
import org.apache.maven.execution.MavenSession;
import org.apache.maven.lifecycle.LifecycleExecutionException;
import org.apache.maven.message.MessageBuilderFactory;
import org.apache.maven.project.DefaultDependencyResolutionRequest;
import org.apache.maven.project.DependencyResolutionException;
import org.apache.maven.project.DependencyResolutionResult;
Expand Down Expand Up @@ -80,6 +81,9 @@ public class LifecycleDependencyResolver {
@Inject
private ProjectArtifactsCache projectArtifactsCache;

@Inject
private MessageBuilderFactory messageBuilderFactory;

public LifecycleDependencyResolver() {}

public LifecycleDependencyResolver(ProjectDependenciesResolver projectDependenciesResolver, Logger logger) {
Expand Down Expand Up @@ -243,7 +247,7 @@ private Set<Artifact> getDependencies(

logger.warn("Try running the build up to the lifecycle phase \"package\"");
} else {
throw new LifecycleExecutionException(null, project, e);
throw new LifecycleExecutionException(messageBuilderFactory, null, project, e);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import org.apache.maven.internal.MultilineMessageHelper;
import org.apache.maven.lifecycle.LifecycleExecutionException;
import org.apache.maven.lifecycle.MissingProjectException;
import org.apache.maven.message.MessageBuilderFactory;
import org.apache.maven.plugin.BuildPluginManager;
import org.apache.maven.plugin.MavenPluginManager;
import org.apache.maven.plugin.MojoExecution;
Expand Down Expand Up @@ -88,6 +89,9 @@ public class MojoExecutor {
@Requirement
private ExecutionEventCatapult eventCatapult;

@Requirement
private MessageBuilderFactory messageBuilderFactory;

private final OwnerReentrantReadWriteLock aggregatorLock = new OwnerReentrantReadWriteLock();

@Requirement
Expand Down Expand Up @@ -186,22 +190,23 @@ private void execute(
try {
mavenPluginManager.checkPrerequisites(mojoDescriptor.getPluginDescriptor());
} catch (PluginIncompatibleException e) {
throw new LifecycleExecutionException(mojoExecution, session.getCurrentProject(), e);
throw new LifecycleExecutionException(messageBuilderFactory, mojoExecution, session.getCurrentProject(), e);
}

if (mojoDescriptor.isProjectRequired() && !session.getRequest().isProjectPresent()) {
Throwable cause = new MissingProjectException(
"Goal requires a project to execute" + " but there is no POM in this directory ("
+ session.getExecutionRootDirectory() + ")."
+ " Please verify you invoked Maven from the correct directory.");
throw new LifecycleExecutionException(mojoExecution, null, cause);
throw new LifecycleExecutionException(messageBuilderFactory, mojoExecution, null, cause);
}

if (mojoDescriptor.isOnlineRequired() && session.isOffline()) {
if (MojoExecution.Source.CLI.equals(mojoExecution.getSource())) {
Throwable cause = new IllegalStateException(
"Goal requires online mode for execution" + " but Maven is currently offline.");
throw new LifecycleExecutionException(mojoExecution, session.getCurrentProject(), cause);
throw new LifecycleExecutionException(
messageBuilderFactory, mojoExecution, session.getCurrentProject(), cause);
} else {
eventCatapult.fire(ExecutionEvent.Type.MojoSkipped, session, mojoExecution);

Expand Down Expand Up @@ -330,7 +335,8 @@ private void doExecute2(MavenSession session, MojoExecution mojoExecution) throw
| PluginManagerException
| PluginConfigurationException
| MojoExecutionException e) {
throw new LifecycleExecutionException(mojoExecution, session.getCurrentProject(), e);
throw new LifecycleExecutionException(
messageBuilderFactory, mojoExecution, session.getCurrentProject(), e);
}

eventCatapult.fire(ExecutionEvent.Type.MojoSucceeded, session, mojoExecution);
Expand Down
Loading