This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 236047 - Maven compile on save should copy main/resources
Summary: Maven compile on save should copy main/resources
Status: RESOLVED FIXED
Alias: None
Product: projects
Classification: Unclassified
Component: Maven (show other bugs)
Version: 8.0
Hardware: PC Linux
: P2 normal (vote)
Assignee: Milos Kleint
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-09-17 02:18 UTC by janario
Modified: 2015-08-29 03:03 UTC (History)
6 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description janario 2013-09-17 02:18:19 UTC
When a Maven project is checked to CompileOnSave and changes are made in any resource(main/resources) NetBeans should copy the files to the dest dir(target/classes).
This allow tools such as jrebel to work right and be notified of changes.

In the default NB project(ant) resources are already with this behavior(copy on save)

Product Version = NetBeans IDE Dev (Build 20130916-bf4eefdc37ae)
Operating System = Linux version 3.8.0-30-generic running on amd64
Java; VM; Vendor = 1.7.0_25
Runtime = Java HotSpot(TM) 64-Bit Server VM 23.25-b01
Comment 1 Milos Kleint 2013-09-17 04:37:59 UTC
this *is* happening for me when the project has CoS turned on.

please provide detailed steps to reproduce or a sample project where the copying is not happening.
Comment 2 Milos Kleint 2013-09-17 04:55:01 UTC
for the record, I've used the nbm-maven-plugin sources, edited a jnlp file from resources and observed if the edit made it to target/classes which it did.
Comment 3 janario 2013-09-17 12:41:40 UTC
I've tried with a new project and it works. 
Maybe is something wrong in my project. I'm going to see what can be wrong

Thanks.
I'm closing this as invalid.
Comment 4 brettryan 2015-08-21 08:28:28 UTC
This isn't invalid and is a bug.

CoS will not work if you have resource filtering enabled in your POM. I can understand how this could be tricky for resources where the filter is enabled and you save a file that matches the pattern, but it should still work for patterns that match the exclusion rule:

Let us examine the following pom filtering rules:

    <resources>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        <includes>
          <include>**/*.properties</include>
        </includes>
      </resource>
      <resource>
        <directory>src/main/resources</directory>
        <filtering>false</filtering>
        <excludes>
          <exclude>**/*.properties</exclude>
        </excludes>
      </resource>
    </resources>

With this (or any other) resource content added to your pom you will no longer be able to save content within src/main/resources. However, I believe that given the above rule files that are not of pattern `**/*.properties' should still be matched and filtered.

I tried creating instructions for creating a project but am on 8.1 Beta and bug:254570 [1] prevented me completing this.

Steps to reproduce:
------------------
1. Checkout the project at https://github.com/brettryan/nb-test-cos.git
2. Run the project
3. Edit the file src/main/resources/test.txt and reload browser
4. Observe that the section within the page will change to the files contents.
5. Clean the project
6. Uncomment the resources section (lines 84 - 101) within pom.xml.
7. Run project again
8. Edit the file as in step 3 and reload page.

Observe that at step #9 that the content will not change.

Observe also that the file is a .txt file and should be included for copying as it is
not filtered within the resource processing section.


[1]: https://netbeans.org/bugzilla/show_bug.cgi?id=254570
Comment 5 Tomas Stupka 2015-08-27 09:52:50 UTC
fixed in jet-main #dee225513055
Comment 6 Tomas Stupka 2015-08-27 09:53:17 UTC
btw - thanks for the great test project
Comment 7 Quality Engineering 2015-08-29 03:03:29 UTC
Integrated into 'main-silver', will be available in build *201508290002* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/dee225513055
User: Tomas Stupka <tstupka@netbeans.org>
Log: Issue #236047 - Maven compile on save should copy main/resources