android - Excluding files with Maven doesn't work -


i run problems @ maven compile when using jmockit junit , android:

[info] unexpected top-level exception: [info] java.lang.illegalargumentexception: added: ljunit/framework/testresult$1;

at least junit , jmockit contain testresult, thought using shade plugin exclude these files:

    <plugin>         <groupid>org.apache.maven.plugins</groupid>         <artifactid>maven-shade-plugin</artifactid>         <version>2.0</version>         <executions>             <execution>                 <phase>package</phase>                 <goals>                     <goal>shade</goal>                 </goals>                 <configuration>                     <filters>                         <filter>                             <artifact>com.googlecode.jmockit:jmockit</artifact>                             <excludes>                                 <exclude>junit/framework/**</exclude>                             </excludes>                         </filter>                         <filter>                             <artifact>junit:junit</artifact>                             <excludes>                                 <exclude>junit/framework/**</exclude>                             </excludes>                         </filter>                     </filters>                     <minimizejar>true</minimizejar>                 </configuration>             </execution>         </executions>     </plugin> 

unfortunately still these errors. ideas what's wrong here or did misunderstand plugin about? or maybe know better solution rid of multiple package clashes maven?

update

(meanwhile unpacked , removed conflicting dependencies manually jars , repacked packages uber jar , installed local repository. works. still interested in more professional solution)

as far know there no way solve issue. in maven exclude problematic transitive dependency on junit jmockit framework. jmockit has same problem maven thirdparty jars have. have included junit dependency in jmockit jar instead of declaring dependency in pom of jmockit. see exclude dependencies how solve maven when jmockit packaged more maven friendly.

but there no way specify want remove classes jmockit dependency maven dependency mechanism.

so choose correct way of creating correct jar file , putting in repository. thing better not manually. create new maven module creating , use dependecy in android project.

the new module depend on junit , jmockit , no source code , have following shade plugin conf:

            <plugin>             <groupid>org.apache.maven.plugins</groupid>             <artifactid>maven-shade-plugin</artifactid>             <version>2.0</version>             <executions>                 <execution>                     <phase>package</phase>                     <goals>                         <goal>shade</goal>                     </goals>                 </execution>             </executions>         </plugin> 

since module jar module , not compiled android did not have problems of duplicate class , shade plugin package 1 testresult class. if want ensure correct 1 packaged can still use filtering exclude jmockit classes , rely on junit once.

with module ensure process documented pom file , switch newer junit or jmockit version. not rely on file installed in local repository deleted accident or missing on other pc.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

javascript - jQuery .height() return 0 when visible but non-0 when hidden -