[ 
https://issues.apache.org/jira/browse/NIFI-8028?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17286367#comment-17286367
 ] 

Chris Sampson edited comment on NIFI-8028 at 2/18/21, 9:13 AM:
---------------------------------------------------------------

An alternative may be to change the relevant enforcer rule to use the suggested 
{{onlyWhenRelease}} property instead of the current 
{{failWhenParentIsSnapshot}} (as is commented in the 
[pom.xml|https://github.com/apache/nifi/blob/main/pom.xml#L643]).

The Wiki should still be updated as suggested, probably with some guidance on 
how to prevent build failure, e.g. include a {{-Denforcer.skip=true}} flag when 
building custom processors with Maven that have a {{-SNAPSHOT}} version - but 
of course, this skips *all* rules, not just the SNAPSHOT check.

*Or* include an enforcer override in the custom processor's pom.xml if the 
developer does not wish to use any enforcer rules during any builds (maybe they 
don't need to follow the same rules as the main NiFi build if they're not going 
to be committing their processors to the NiFi repository), e.g.
{code:xml}
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
{code}
or
{code:xml}
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <inherited>false</inherited>
            </plugin>
        </plugins>
{code}

Maybe the archetype could be updated to include one of the above but, by 
default, execute the enforcer rules - then all a developer needs to do is 
change a boolean property to allow their build to run as they may desire (i.e. 
many developers are likely to use {{-SNAPSHOT}} versions during local/initial 
development before releasing their code... much like is done in the main 
apache/nifi repo, of course).

The above could also be rolled into an optional profile, such as:
{code:xml}
        <profile>
            <id>snapshot</id>
            <activation>
                <property>
                    <name>changelist</name>
                    <value>-SNAPSHOT</value>
                </property>
            </activation>

            <build>
                <plugins>
                    <plugin>
                        <groupId>org.apache.maven.plugins</groupId>
                        <artifactId>maven-enforcer-plugin</artifactId>
                        <configuration>
                            <skip>true</skip>
                        </configuration>
                    </plugin>
                </plugins>
            </build>
        </profile>
{code}
This assumes the user is specifying their use of the {{-SNAPSHOT}} suffix by 
way of the {{changelist}} property (so an alternative may well be more suitable 
for other developers not using a [Maven CI 
Friendly|https://maven.apache.org/maven-ci-friendly.html] build approach with 
the newer built-in properties.


was (Author: chris s):
An alternative may be to change the relevant enforcer rule to use the suggested 
{{onlyWhenRelease}} property instead of the current 
{{failWhenParentIsSnapshot}} (as is commented in the 
[pom.xml|https://github.com/apache/nifi/blob/main/pom.xml#L643]).

The Wiki should still be updated as suggested, probably with some guidance on 
how to prevent build failure, e.g. include a {{-Denforcer.skip=true}} flag when 
building custom processors with Maven that have a {{-SNAPSHOT}} version - but 
of course, this skips *all* rules, not just the SNAPSHOT check.

*Or* include an enforcer override in the custom processor's pom.xml if the 
developer does not wish to use any enforcer rules during any builds (maybe they 
don't need to follow the same rules as the main NiFi build if they're not going 
to be committing their processors to the NiFi repository), e.g.
{code:xml}
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <configuration>
                    <skip>true</skip>
                </configuration>
            </plugin>
        </plugins>
{code}
or
{code:xml}
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-enforcer-plugin</artifactId>
                <inherited>false</inherited>
            </plugin>
        </plugins>
{code}

Maybe the archetype could be updated to include one of the above but, by 
default, execute the enforcer rules - then all a developer needs to do is 
change a boolean property to allow their build to run as they may desire (i.e. 
many developers are likely to use {{-SNAPSHOT}} versions during local/initial 
development before releasing their code... much like is done in the main 
apache/nifi repo, of course).

> Cannot compile "SNAPSHOT" extention
> -----------------------------------
>
>                 Key: NIFI-8028
>                 URL: https://issues.apache.org/jira/browse/NIFI-8028
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Extensions
>    Affects Versions: 1.12.0, 1.12.1
>            Reporter: humpfhumpf
>            Priority: Minor
>
> Since NIFI-7291, the master pom.xml forbids to compile an extension with 
> version like "1.0-SNAPSHOT" (through `enforce-no-snapshots` rule).
> The [Wiki 
> page|https://cwiki.apache.org/confluence/display/NIFI/Maven+Projects+for+Extensions]
>  should mention it.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to