Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a workaround to the encoding problem from polyglot #2176

Merged
merged 1 commit into from
Mar 1, 2023
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
package org.eclipse.tycho.pomless;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;
import java.util.Map;

import javax.annotation.Priority;

import org.apache.maven.model.Model;
import org.apache.maven.model.building.ModelProcessor;
import org.apache.maven.model.io.ModelParseException;
import org.codehaus.plexus.component.annotations.Component;
import org.codehaus.plexus.util.ReaderFactory;
import org.sonatype.maven.polyglot.TeslaModelProcessor;

//This is a hack until https://github.com/takari/polyglot-maven/pull/259 is fixed
@Component(role = ModelProcessor.class)
@Priority(10)
public class TychoTeslaModelProcessor extends TeslaModelProcessor {
@Override
public Model read(final File input, final Map<String, ?> options) throws IOException, ModelParseException {
Model model;
try (Reader reader = ReaderFactory.newXmlReader(input)) {
model = read(reader, options);
model.setPomFile(input);
}
return model;
}

@Override
public Model read(final InputStream input, final Map<String, ?> options) throws IOException, ModelParseException {
try (Reader reader = ReaderFactory.newXmlReader(input)) {
return read(reader, options);
}
}
}