Re: maven-enforcer-plugin rules question

2017-01-10 Thread Curtis Rueden
Hi Martin,

I do not see how your example constitutes a "package cycle"? Both ClassA
and ClassB belong to the same package.

Put ClassA or ClassB into a different package, and see if the rule
complains.

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - http://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - http://imagej.net/User:Rueden


On Tue, Jan 10, 2017 at 11:05 AM, Martin Gainty  wrote:

> i couldnt get it this cycle failure:
>
> Test set: de.andrena.tools.nopackagecycles.PackageCycleCollectorPerforman
> ceTest
> 
> ---
> Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.133 sec
> - in de.andrena.tools.nopackagecycles.PackageCycleCollectorPerformanceTest
>
>
>
> package de.andrena.tools.nopackagecycles;
> import static org.hamcrest.MatcherAssert.assertThat;
> import static org.hamcrest.Matchers.empty;
> import static org.hamcrest.Matchers.is;
> import java.util.ArrayList;
> import java.util.Collections;
> import java.util.HashSet;
> import java.util.List;
> import java.util.Set;
> import jdepend.framework.JavaPackage;
> import org.junit.Before;
> import org.junit.Test;
> import de.andrena.tools.nopackagecycles.ClassB;
>
> public class ClassB extends ClassA
> {
>  public ClassA classA=null; //OK
> }
>
>
>
> public class PackageCycleCollectorPerformanceTest {
>
>
> //add one obvious cycle
>
>
> public void findRealPackageCycle() throws Exception {
> JavaPackage javaPackage =new JavaPackage("de.andrena.tools.
> nopackagecycles");
> JavaClass javaClassA=new JavaClass("ClassA");
> javaPackage.addClass(javaClassA);
> JavaClass javaClassB=new JavaClass("ClassB");
> javaPackage.addClass(javaClassB);
> allPackages.add(javaPackage);
>List cycles = new PackageCycleCollector().
> collectCycles(allPackages);
> assertThat(cycles, is(empty()));
> }
> ...
> }
>
>
> package de.andrena.tools.nopackagecycles;
> import static org.hamcrest.MatcherAssert.assertThat;
> import static org.hamcrest.Matchers.empty;
> import static org.hamcrest.Matchers.is;
> import java.util.ArrayList;
> import java.util.Collections;
> import java.util.HashSet;
> import java.util.List;
> import java.util.Set;
> import jdepend.framework.JavaPackage;
> import org.junit.Before;
> import org.junit.Test;
> import de.andrena.tools.nopackagecycles.ClassB;
> public class ClassA
> {
>  public de.andrena.tools.nopackagecycles.ClassB classB=null; //detect
> this cycle!
> }
>
>
> what am i doing wrong?
>
>
> Thanks Curtis
>
> Martin
> __
>
>
> 
> From: ctrueden.w...@gmail.com  on behalf of
> Curtis Rueden 
> Sent: Tuesday, January 10, 2017 11:02 AM
> To: Maven Users List
> Subject: Re: maven-enforcer-plugin rules question
>
> Hi Martin,
>
> A quick Google search revealed this:
> https://github.com/andrena/no-package-cycles-enforcer-rule
> [https://avatars2.githubusercontent.com/u/1824230?v=3=400] github.com/andrena/no-package-cycles-enforcer-rule>
>
> GitHub - andrena/no-package-cycles-enforcer-rule ... andrena/no-package-cycles-enforcer-rule>
> github.com
> no-package-cycles-enforcer-rule - Shamelessly copied and improved from
> http://stackoverflow.com/questions/3416547/maven-
> jdepend-fail-build-with-cycles
>
>
>
>
> I haven't tried it personally. Though now that I know about it, I'm sorely
> tempted-it would certainly improve the API design.
>
> Regards,
> Curtis
>
> --
> Curtis Rueden
> LOCI software architect - http://loci.wisc.edu/software
> ImageJ2 lead, Fiji maintainer - http://imagej.net/User:Rueden
> [https://gravatar.com/avatar/63df759e2779af56fd050a968ff98d09]<
> http://imagej.net/User:Rueden>
>
> User:Rueden - ImageJ
> imagej.net
> What is Curtis working on? Primary projects. Here is a summary of my
> current projects, in priority order. I try to keep this list up to date.
> The ImageJ2 paper.
>
>
>
>
>
> On Tue, Jan 10, 2017 at 9:34 AM, Martin Gainty 
> wrote:
>
> > I need to detect package cycles such as what is seen here:
> >
> > class ClassA
> >
> > {
> >
> >  ClassB classB; //detect this package cycle!
> >
> > }
> > class ClassB extends ClassA
> >
> > {
> >
> > }
> >
> >
> > which maven-enforcer-plugin rule will allow me to detect package cycle?
> >
> >
> > http://maven.apache.org/enforcer/enforcer-rules/index.html
> Apache Maven Enforcer Rules - Standard Rules enforcer/enforcer-rules/index.html>
> maven.apache.org
> Standard Rules. The following standard rules ship along with the enforcer
> plugin: alwaysFail - Always fail... used to test plugin configuration.
> alwaysPass - Always ...
>
>
>
> >
> > Apache Maven Enforcer Rules - Standard Rules > enforcer/enforcer-rules/index.html>
> > maven.apache.org
> > Standard Rules. The following 

Re: maven-enforcer-plugin rules question

2017-01-10 Thread Martin Gainty
i couldnt get it this cycle failure:

Test set: de.andrena.tools.nopackagecycles.PackageCycleCollectorPerformanceTest
---
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.133 sec - in 
de.andrena.tools.nopackagecycles.PackageCycleCollectorPerformanceTest



package de.andrena.tools.nopackagecycles;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.is;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import jdepend.framework.JavaPackage;
import org.junit.Before;
import org.junit.Test;
import de.andrena.tools.nopackagecycles.ClassB;

public class ClassB extends ClassA
{
 public ClassA classA=null; //OK
}



public class PackageCycleCollectorPerformanceTest {


//add one obvious cycle


public void findRealPackageCycle() throws Exception {
JavaPackage javaPackage =new JavaPackage("de.andrena.tools.nopackagecycles");
JavaClass javaClassA=new JavaClass("ClassA");
javaPackage.addClass(javaClassA);
JavaClass javaClassB=new JavaClass("ClassB");
javaPackage.addClass(javaClassB);
allPackages.add(javaPackage);
   List cycles = new 
PackageCycleCollector().collectCycles(allPackages);
assertThat(cycles, is(empty()));
}
...
}


package de.andrena.tools.nopackagecycles;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.is;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import jdepend.framework.JavaPackage;
import org.junit.Before;
import org.junit.Test;
import de.andrena.tools.nopackagecycles.ClassB;
public class ClassA
{
 public de.andrena.tools.nopackagecycles.ClassB classB=null; //detect this 
cycle!
}


what am i doing wrong?


Thanks Curtis

Martin
__



From: ctrueden.w...@gmail.com  on behalf of Curtis 
Rueden 
Sent: Tuesday, January 10, 2017 11:02 AM
To: Maven Users List
Subject: Re: maven-enforcer-plugin rules question

Hi Martin,

A quick Google search revealed this:
https://github.com/andrena/no-package-cycles-enforcer-rule
[https://avatars2.githubusercontent.com/u/1824230?v=3=400]

GitHub - andrena/no-package-cycles-enforcer-rule 
...
github.com
no-package-cycles-enforcer-rule - Shamelessly copied and improved from 
http://stackoverflow.com/questions/3416547/maven-jdepend-fail-build-with-cycles




I haven't tried it personally. Though now that I know about it, I'm sorely
tempted-it would certainly improve the API design.

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - http://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - http://imagej.net/User:Rueden
[https://gravatar.com/avatar/63df759e2779af56fd050a968ff98d09]

User:Rueden - ImageJ
imagej.net
What is Curtis working on? Primary projects. Here is a summary of my current 
projects, in priority order. I try to keep this list up to date. The ImageJ2 
paper.





On Tue, Jan 10, 2017 at 9:34 AM, Martin Gainty  wrote:

> I need to detect package cycles such as what is seen here:
>
> class ClassA
>
> {
>
>  ClassB classB; //detect this package cycle!
>
> }
> class ClassB extends ClassA
>
> {
>
> }
>
>
> which maven-enforcer-plugin rule will allow me to detect package cycle?
>
>
> http://maven.apache.org/enforcer/enforcer-rules/index.html
Apache Maven Enforcer Rules - Standard 
Rules
maven.apache.org
Standard Rules. The following standard rules ship along with the enforcer 
plugin: alwaysFail - Always fail... used to test plugin configuration. 
alwaysPass - Always ...



>
> Apache Maven Enforcer Rules - Standard Rules enforcer/enforcer-rules/index.html>
> maven.apache.org
> Standard Rules. The following standard rules ship along with the enforcer
> plugin: alwaysFail - Always fail... used to test plugin configuration.
> alwaysPass - Always ...
>
>
>
>
> Thanks!
>
> Martin
> __
>
>


Re: maven-enforcer-plugin rules question

2017-01-10 Thread Curtis Rueden
Hi Martin,

A quick Google search revealed this:
https://github.com/andrena/no-package-cycles-enforcer-rule

I haven't tried it personally. Though now that I know about it, I'm sorely
tempted—it would certainly improve the API design.

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - http://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - http://imagej.net/User:Rueden


On Tue, Jan 10, 2017 at 9:34 AM, Martin Gainty  wrote:

> I need to detect package cycles such as what is seen here:
>
> class ClassA
>
> {
>
>  ClassB classB; //detect this package cycle!
>
> }
> class ClassB extends ClassA
>
> {
>
> }
>
>
> which maven-enforcer-plugin rule will allow me to detect package cycle?
>
>
> http://maven.apache.org/enforcer/enforcer-rules/index.html
>
> Apache Maven Enforcer Rules - Standard Rules enforcer/enforcer-rules/index.html>
> maven.apache.org
> Standard Rules. The following standard rules ship along with the enforcer
> plugin: alwaysFail - Always fail... used to test plugin configuration.
> alwaysPass - Always ...
>
>
>
>
> Thanks!
>
> Martin
> __
>
>


maven-enforcer-plugin rules question

2017-01-10 Thread Martin Gainty
I need to detect package cycles such as what is seen here:

class ClassA

{

 ClassB classB; //detect this package cycle!

}
class ClassB extends ClassA

{

}


which maven-enforcer-plugin rule will allow me to detect package cycle?


http://maven.apache.org/enforcer/enforcer-rules/index.html

Apache Maven Enforcer Rules - Standard 
Rules
maven.apache.org
Standard Rules. The following standard rules ship along with the enforcer 
plugin: alwaysFail - Always fail... used to test plugin configuration. 
alwaysPass - Always ...




Thanks!

Martin
__