getting error Execution failed for task ':app:checkDebugDuplicateClasses' - nativescript

i just added tns plugin add nativescript-pager and run the app tns build android
I'm sure that its because of the new updates given to plugin for ns 6 version. but i'm not getting how to solve this.
Duplicate class com.rd.IndicatorManager found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.IndicatorManager$Listener found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.PageIndicatorView found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.PageIndicatorView$1 found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.PageIndicatorView$2 found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.PageIndicatorView$3 found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.animation.AnimationManager found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.animation.controller.AnimationController found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
.
.
.
.
.
Duplicate class com.rd.animation.type.FillAnimation$1 found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar
(com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.animation.type.ScaleAnimation found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.animation.type.ScaleAnimation$1 found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.animation.type.ScaleDownAnimation found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.animation.type.SlideAnimation found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.animation.type.SlideAnimation$1 found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.animation.type.SwapAnimation found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.animation.type.SwapAnimation$1 found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar
(com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.animation.type.ThinWormAnimation found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.animation.type.ThinWormAnimation$1 found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.animation.type.WormAnimation found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.animation.type.WormAnimation$1 found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar
(com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.animation.type.WormAnimation$RectValues found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.draw.DrawManager found in modules classes.jar
.
.
.
.
modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.draw.data.PositionSavedState found in modules classes.jar .
.
.
.
Duplicate class com.rd.draw.drawer.type.ScaleDrawer found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar (com.romandanylyk:pageindicatorview:1.0.3)
Duplicate class com.rd.draw.drawer.type.SlideDrawer found in modules classes.jar (com.github.adrielcafe:PageIndicatorView:1.0.6) and classes.jar
.
.
.
.
Go to the documentation to learn how to Fix dependency resolution errors.
So, i need a way to resolve this issue because those people who developed plugin haven't tested this before releasing.
i cannot even start with plugin.
Edit :-
I got to know one thing that, because i'm using naivescript-carousel plugin nativescript-pager was giving this error. But I need carousel to auto display stream of images. and pager for quiz screen. What shall i do now.

Related

Wildfly - Java8 - UT010009(does not implement javax.servlet.Servlet)

Migrating java7 to java8 and used wildfly to deploy the services. During deployment following Error is blocking the migration.
Caused by: java.lang.IllegalArgumentException: UT010009: Servlet dispatcher of type class org.springframework.web.servlet.DispatcherServlet does not implement javax.servlet.Servlet
#Jboss-deployment-structure.xml following exclusion is defined
<exclusions>
<module name="javax.api" />
<module name="javax.servlet.api" />
</exclusions>
spring version "4.3.4.RELEASE"
Any advice :)
Thanks in advance!!
It looks like you're ending up with two different javax.servlet.Servlet on your class path. You should not be excluding the javax.api and javax.servlet.api modules and you should make sure your deployment does not contain the a servlet API or implementation module.

Creating A Bean From Another Maven Module

Creating a bean in a Maven project is rather simple. You add the #Autowiredannotation to the bean you wish to create and then declare its config in the spring-config.xml:
#Autowired
private ExampleBean exampleBean;
.
.
.
<bean id="exampleBean" class="path.to.your.bean">
<property name="hibernateTemplate" ref="hibernateTemplate" />
</bean>
But what if I have a multi-moduled Maven project and the bean I would like to create is from another module referenced in the build path? How do you go about creating that bean?
I thought about the annotation #Resource but it didn't seem to "detect" the bean that is coming from another module added in the build path.
UPDATE 1:
Based on RĂ©mi's answer, here's what I did:
I added the following line to the xml config file of the module I wish to create the bean in:
<import resource="classpath:\dsp2aisp-business\*\root-context.xml" />
I also kept the #Autowired annotation on the AccountService (which is the bean I would like to use in this module).
In the other module where the AccountService is declared I added the bean declaration:
<bean id="accountService" class="fr.bnp.dsp2aisp.service.AccountService">
<property name="hibernateTemplate" ref="hibernateTemplate" />
</bean>
But I kept getting this error:
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [fr.bnp.dsp2aisp.service.AccountService] for bean with name 'accountService' defined in ServletContext resource [/WEB-INF/spring/root-context.xml]; nested exception is java.lang.ClassNotFoundException: fr.bnp.dsp2aisp.service.AccountService
But I'm certain that the class does in fact exist in the specified path.
Is there maybe another way to use a bean that is declared in another Maven Module?
I finally got it to work. When you have a multi-moduled Maven project, and you're trying to import one of those modules into another to use its classes, you shouldn't add your module from the build path (properties -> Java Build Path -> Projects ->add) because the compiler won't be able to find those classes in runtime.
What you need to do is to simply add those modules as Maven dependencies in the POM.xml file of the module you wish to use them in.
Example:
<dependency>
<groupId>com.test</groupId>
<artifactId>test-infra</artifactId>
<version>0.0.1-SNAPSHOT</version>
</dependency>
The solution is insanely easy but finding it was a little bit tiring. I hope it'll help somebody else with the same problem.
You could do this by importing other maven project bean context form classpath :
<import resource="classpath:path/to/another/maven/module/context.xml" />
Then you can use all the beans defined in other maven project context in your actual maven project

How to configure taglib with java configuration

I got rid of web.xml and replaced it with 2 classes to configure the servlet environment.
public class UsersWebAppInitializer extends AbstractAnnotationConfigDispatcherServletInitializer
and
public class WebConfig extends WebMvcConfigurerAdapter
My question is, how can I use one of these classes to configure the equivalent of a taglib declaration in the Web.xml?
e.g - how would I write this in java configuration?
<taglib>
<taglib-uri>
http://www.example.com/taglib
</taglib-uri>
<taglib-location>
/taglib.tld
</taglib-location>
</taglib>
You don't have to configure anything. Since JSP 2.0 taglibs can be discovered automatically.
All You need to do is place them in WEB-INF or it's subfolders. If you are packaging Your TLDs as JAR files, place them in WEB-INF/lib or META-INF of the JAR

Spring context scanning behavior

I'm getting the following:
2013-03-27 18:51:54,944 ERROR pringframework.web.context.ContextLoader: 227 - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'exporter' defined in URL ... Cannot resolve reference to bean 'dynamicNamingStrategy' while setting bean property 'namingStrategy'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'dynamicNamingStrategy' is defined
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)
at
and also STS is complaining:
Multiple annotations found at this line:
- Referenced bean 'dynamicNamingStrategy'
not found
with the following Spring contexts setup:
In a project, I have a jmx management context (core-app-web-common-management-context.xml) with following (excerpt):
<context:annotation-config />
<context:component-scan
base-package="com.a.b.c.management.*" />
<bean id="exporter" class="org.springframework.jmx.export.MBeanExporter"
lazy-init="false">
<property name="autodetect" value="true"></property>
<property name="namingStrategy" ref="dynamicNamingStrategy"/>
where dynamicNamingStrategy is defined in a different project (and packaged into a different jar) and is referred to in the component-scan above, as follows
package com.a.b.c.management;
#Component("dynamicNamingStrategy")
public class DynamicNamingStrategy extends KeyNamingStrategy {
......
The above Spring context is in turn imported into the main context located in the same project:
<import resource="classpath*:/META-INF/spring/core-app-web-common-management-context.xml"/>
So, somehow the #Component scanning for DynamicNamingStrategy is not working...
If I instead use this property definition in exporter, then it works:
<property name="namingStrategy"><bean class="com.a.b.c.management.DynamicNamingStrategy" /></property>
but I'd like to understand why the component scanning mechanism falters in the first instance, apparently I'm missing something.
Also, Spring Explorer view in STS is missing that bean as well. Enabling support for elements in configuration files option doesn't seem to make a difference.
Drop the .* at the end of your package name in your <context:component-scan> elements base-package attribute. I would think that this is causing the component-scan to look for a package named *, which there probably isn't one (can't be one).
The base-package is just that, the base package. The component-scan will scan all children of all base packages, therefore there is no need to have the .* wildcard at the end of your package name.

conflicts with existing, non-compatible bean definition of same name and class

i get this error after i obfuscate my project , eventghout only my implementation class com.company.project.f.a.a.b is qualified by #Component("myImpl")
java.lang.IllegalStateException: Annotation-specified bean name
'myImpl' for bean class
[com.company.project.f.a.a.b] conflicts with existing, non-compatible
bean definition of same name and class [com.company.project.f.a.a.a]
i don't realy understand why spring attributes the same name for both the interface and the implementation . could it be something wrong with my Proguard config ?
What you can try is to keep #Component classes as is by telling proguard to do so through a -keep option.
In case if you use a proguarg maven plugin you can set this option as:
<plugin>
... ...
<artifactId>proguard-maven-plugin</artifactId>
... ...
<configuration>
<obfuscate>true</obfuscate>
<options>
... ...
<option>-keep #org.springframework.stereotype.Component class *</option>
... ...
</options>
... ...
</configuration>
</plugin>
It'll keep #Component components reverse engineer and Spring friendly :)
i found the source of the problem , Proguard merges interaces with their implementation if the optimizer is enabled.
i added
-dontoptimize
and the probleme is solved
for #Component
<option>-keep #org.springframework.stereotype.Component class *</option>
for #Controller
<option>-keep #org.springframework.stereotype.Controller class *</option>
for #Service
<option>-keep #org.springframework.stereotype.Service class *</option>
Sometimes the problem occurs if you have moved your classes around and it refers to old classes, even if they don't exist.
In this case, just do this :
mvn eclipse:clean
mvn eclipse:eclipse
This worked well for me.

Resources