Skip to content

Commit

Permalink
Merge pull request #374 from jfdenise/9.x
Browse files Browse the repository at this point in the history
Resync 9.x with main branch fixes. Some component upgrades.
  • Loading branch information
jfdenise authored Nov 17, 2023
2 parents be94905 + 792a12d commit 386229f
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public class BootLoggingConfiguration { //extends AbstractLogEnabled {
"user.dir",
"user.home"
);

private static final String KEY_OVERRIDES = "keyOverrides";
private final Map<String, String> properties;
private final Map<String, String> usedProperties;
private final Map<String, String> additionalPatternFormatters;
Expand Down Expand Up @@ -335,18 +335,19 @@ private void writeStructuredFormatter(final String type, final Writer writer,
final ModelNode model = property.getValue().clone();
final String prefix = "formatter." + name;
writeProperty(writer, prefix, null, type);

boolean needKeyOverrides = !model.hasDefined("key-overrides");
// The key-overrides are used as constructor parameters
if (model.hasDefined("key-overrides")) {
writeProperty(writer, prefix, "constructorProperties", "keyOverrides");
}

// This property is alwasy added.
writeProperty(writer, prefix, "constructorProperties", KEY_OVERRIDES);
// Next we need to write the properties
final Collection<String> definedPropertyNames = model.asPropertyList()
.stream()
.filter((p) -> p.getValue().isDefined())
.map(Property::getName)
.collect(Collectors.toList());
if (needKeyOverrides) {
definedPropertyNames.add(KEY_OVERRIDES);
}
writeProperty(writer, prefix, "properties", toCsvString(definedPropertyNames
.stream()
.map(BootLoggingConfiguration::resolvePropertyName)
Expand All @@ -359,7 +360,12 @@ private void writeStructuredFormatter(final String type, final Writer writer,
if ("exception-output-type".equals(attributeName)) {
writeProperty(writer, prefix, resolvePropertyName(attributeName), toEnumString(model.get(attributeName)));
} else {
writeProperty(writer, prefix, resolvePropertyName(attributeName), value);
if (needKeyOverrides && KEY_OVERRIDES.equals(attributeName)) {
// The value is empty if explicitely added.
writeProperty(writer, prefix, resolvePropertyName(attributeName), "");
} else {
writeProperty(writer, prefix, resolvePropertyName(attributeName), value);
}
}
}
writer.write(NEW_LINE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,11 @@
import org.jboss.galleon.universe.maven.MavenUniverseException;
import org.jboss.galleon.universe.maven.repo.MavenRepoManager;
import org.jboss.galleon.util.ZipUtils;
import org.wildfly.channel.ArtifactTransferException;
import org.wildfly.channel.Channel;
import org.wildfly.channel.ChannelManifest;
import org.wildfly.channel.ChannelSession;
import org.wildfly.channel.NoStreamFoundException;
import org.wildfly.channel.Repository;
import org.wildfly.channel.UnresolvedMavenArtifactException;
import org.wildfly.channel.maven.VersionResolverFactory;
Expand Down Expand Up @@ -99,7 +101,9 @@ public ChannelMavenArtifactRepositoryManager(List<ChannelConfiguration> channels
public void resolve(MavenArtifact artifact) throws MavenUniverseException {
try {
resolveFromChannels(artifact);
} catch (UnresolvedMavenArtifactException ex) {
} catch (ArtifactTransferException ex) {
throw new MavenUniverseException(ex.getLocalizedMessage(), ex);
} catch (NoStreamFoundException ex) {
boolean requireChannel = Boolean.parseBoolean(artifact.getMetadata().get(REQUIRE_CHANNEL_FOR_ALL_ARTIFACT));
if (!requireChannel) {
// Could be a feature-pack that could require to be resolved from a channel.
Expand All @@ -112,19 +116,21 @@ public void resolve(MavenArtifact artifact) throws MavenUniverseException {
}
}
if (!requireChannel) {
log.warn("Resolution of artifact " + artifact.getGroupId() + ":"
+ artifact.getArtifactId() + " failed using configured channels. Using original version.");
log.warn("Resolution of artifact " + artifact.getGroupId() + ":" +
artifact.getArtifactId() + " failed using configured channels. Using original version.");
// unable to resolve the artifact through the channel.
// if the version is defined, let's resolve it directly
if (artifact.getVersion() == null) {
log.error("No version provided.");
throw new MavenUniverseException(ex.getLocalizedMessage(), ex);
}
try {
log.warn("Using version " + artifact.getVersion()
+ " to resolve artifact " + artifact.getGroupId() + ":"
+ artifact.getArtifactId());
org.wildfly.channel.MavenArtifact mavenArtifact = channelSession.resolveDirectMavenArtifact(artifact.getGroupId(), artifact.getArtifactId(), artifact.getExtension(), artifact.getClassifier(), artifact.getVersion());
log.warn("Using version " + artifact.getVersion() +
" to resolve artifact " + artifact.getGroupId() + ":" +
artifact.getArtifactId());
org.wildfly.channel.MavenArtifact mavenArtifact = channelSession.resolveDirectMavenArtifact(
artifact.getGroupId(), artifact.getArtifactId(), artifact.getExtension(), artifact.getClassifier(),
artifact.getVersion());
artifact.setPath(mavenArtifact.getFile().toPath());
} catch (UnresolvedMavenArtifactException e) {
// if the artifact can not be resolved directly either, we abort
Expand All @@ -138,16 +144,16 @@ public void resolve(MavenArtifact artifact) throws MavenUniverseException {

private boolean fpRequireChannel(MavenArtifact artifact) throws Exception {
boolean requireChannel = false;
if (artifact.getVersion() != null && artifact.getExtension() != null && artifact.getExtension().equalsIgnoreCase("zip")) {
org.wildfly.channel.MavenArtifact mavenArtifact = channelSession.
resolveDirectMavenArtifact(artifact.getGroupId(),
artifact.getArtifactId(),
artifact.getExtension(),
artifact.getClassifier(),
artifact.getVersion());
if (artifact.getVersion() != null && artifact.getExtension() != null
&& artifact.getExtension().equalsIgnoreCase("zip")) {
org.wildfly.channel.MavenArtifact mavenArtifact = channelSession.resolveDirectMavenArtifact(artifact.getGroupId(),
artifact.getArtifactId(),
artifact.getExtension(),
artifact.getClassifier(),
artifact.getVersion());
try {
FeaturePackDescriber.readSpec(mavenArtifact.getFile().toPath());
} catch(ProvisioningException ex) {
} catch (ProvisioningException ex) {
// Not a feature-pack
return requireChannel;
}
Expand All @@ -157,7 +163,7 @@ private boolean fpRequireChannel(MavenArtifact artifact) throws Exception {
final Path channelPropsPath = wfRes.resolve("wildfly-channel.properties");
if (Files.exists(channelPropsPath)) {
Properties props = new Properties();
try(BufferedReader reader = Files.newBufferedReader(channelPropsPath)) {
try (BufferedReader reader = Files.newBufferedReader(channelPropsPath)) {
props.load(reader);
}
String resolution = props.getProperty("resolution");
Expand Down
18 changes: 9 additions & 9 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,20 @@
<version.junit>4.13.1</version.junit>
<version.adoc-maven-plugin-descriptor>1.0.0.Alpha3</version.adoc-maven-plugin-descriptor>
<version.org.apache.maven.core>3.8.4</version.org.apache.maven.core>
<version.org.apache.maven.plugin-tools>3.6.4</version.org.apache.maven.plugin-tools>
<version.org.apache.maven.plugin-plugin>3.6.4</version.org.apache.maven.plugin-plugin>
<version.org.apache.maven.plugin-tools>3.7.0</version.org.apache.maven.plugin-tools>
<version.org.apache.maven.plugin-plugin>3.7.0</version.org.apache.maven.plugin-plugin>
<version.org.asciidoctor>2.0.0</version.org.asciidoctor>
<version.org.jboss.galleon>5.1.0.Final</version.org.jboss.galleon>
<version.org.wildfly.core.wildfly-core>20.0.1.Final</version.org.wildfly.core.wildfly-core>
<version.org.wildfly.common>1.5.4.Final</version.org.wildfly.common>
<version.org.wildfly.plugins.wildfly-maven-plugin>4.1.0.Final</version.org.wildfly.plugins.wildfly-maven-plugin>
<version.org.wildfly.channel>1.0.0.Final</version.org.wildfly.channel>
<version.org.wildfly.prospero>1.0.0.Final</version.org.wildfly.prospero>
<version.org.jboss.galleon>5.1.2.Final</version.org.jboss.galleon>
<version.org.wildfly.core.wildfly-core>20.0.2.Final</version.org.wildfly.core.wildfly-core>
<version.org.wildfly.common>1.6.0.Final</version.org.wildfly.common>
<version.org.wildfly.plugins.wildfly-maven-plugin>4.1.1.Final</version.org.wildfly.plugins.wildfly-maven-plugin>
<version.org.wildfly.channel>1.0.5.Final</version.org.wildfly.channel>
<version.org.wildfly.prospero>1.1.5.Final</version.org.wildfly.prospero>
<maven.surefire.plugin>3.0.0-M6</maven.surefire.plugin>
<!-- required by tests -->
<version.org.apache.httpcomponents.httpclient>4.5.13</version.org.apache.httpcomponents.httpclient>
<version.org.eclipse.aether>1.1.0</version.org.eclipse.aether>
<version.org.jboss.logging.slf4j-jboss-logging>1.1.0.Final</version.org.jboss.logging.slf4j-jboss-logging>
<version.org.jboss.logging.slf4j-jboss-logging>1.2.1.Final</version.org.jboss.logging.slf4j-jboss-logging>
<version.org.apache.maven.plugin-testing.maven-plugin-testing-harness>3.3.0
</version.org.apache.maven.plugin-testing.maven-plugin-testing-harness>
<version.org.jboss.shrinkwrap.shrinkwrap>1.2.6</version.org.jboss.shrinkwrap.shrinkwrap>
Expand Down

0 comments on commit 386229f

Please sign in to comment.