[shrinkwrap-issues] [JBoss JIRA] (SHRINKRES-100) Allow Maven resource filtering to be applied for resources imported via MavenImporter

Yannick Majoros (JIRA) issues at jboss.org
Thu May 7 03:23:46 EDT 2015


    [ https://issues.jboss.org/browse/SHRINKRES-100?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13066085#comment-13066085 ] 

Yannick Majoros commented on SHRINKRES-100:
-------------------------------------------

As a workaround for my usage, I ended up with this in @Deployment:

    Properties testProperties = new Properties();
    ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
    InputStream testPropertiesInputStream = contextClassLoader.getResourceAsStream("test.properties");
    testProperties.load(testPropertiesInputStream);

    File testPropertiesTargetFile = File.createTempFile("arquillian_test_", ".properties");
    try (Writer testPropertiesWriter = Files.newBufferedWriter(testPropertiesTargetFile.toPath())) {
        testProperties.store(testPropertiesWriter, null);
    }
    webArchive.addAsResource(testPropertiesTargetFile, "test.properties");

And this in @Setup:

    private Properties testProperties;

    @Before
    public void setUp() throws IOException {
        testProperties = new Properties();
        InputStream testPropertiesInputStream = this.getClass().getResourceAsStream("/test.properties");
        testProperties.load(testPropertiesInputStream);
    }As a workaround, I ended up with this in @Deployment:

    Properties testProperties = new Properties();
    ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
    InputStream testPropertiesInputStream = contextClassLoader.getResourceAsStream("test.properties");
    testProperties.load(testPropertiesInputStream);

    File testPropertiesTargetFile = File.createTempFile("arquillian_test_", ".properties");
    try (Writer testPropertiesWriter = Files.newBufferedWriter(testPropertiesTargetFile.toPath())) {
        testProperties.store(testPropertiesWriter, null);
    }
    webArchive.addAsResource(testPropertiesTargetFile, "test.properties");

And this in @Setup:

    private Properties testProperties;

    @Before
    public void setUp() throws IOException {
        testProperties = new Properties();
        InputStream testPropertiesInputStream = this.getClass().getResourceAsStream("/test.properties");
        testProperties.load(testPropertiesInputStream);
    }

> Allow Maven resource filtering to be applied for resources imported via MavenImporter
> -------------------------------------------------------------------------------------
>
>                 Key: SHRINKRES-100
>                 URL: https://issues.jboss.org/browse/SHRINKRES-100
>             Project: ShrinkWrap Resolvers
>          Issue Type: Feature Request
>          Components: maven
>            Reporter: Karel Piwko
>              Labels: api-change
>
> When packaging resources to via MavenImporter, any filters defined on the path are ignored. Add support for applying filters.



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


More information about the shrinkwrap-issues mailing list