-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a workaround to the encoding problem from polyglot
- Loading branch information
Showing
1 changed file
with
38 additions
and
0 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
...xtras/tycho-pomless/src/main/java/org/eclipse/tycho/pomless/TychoTeslaModelProcessor.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
} | ||
} | ||
} |