Cordova: Add native code without plugins in config.xml - java

How can I add android native code to a Cordova based project without creating a plugin? what are the entries to put in config.xml?
I'm asking because I have native code that I want to add which is specific to my project and I don't want to always have to remove and re-add the plugin, it will also make svn cycles more complicated.
Is it even possible?
The only part in config.xml that I see that might be related are-
<feature name="NiceNativeFeature">
<param name="android-package" value="com.mycomp.plugins.YourClass"/>
<param name="onload" value="true" />
</feature>
Thanks.

Related

Choose one dependency as precedent over another for an arbitrary list of packages in the IntelliJ Builder

Goal
I'm trying to make my maven project use the IntelliJ builder when I'm editing code because the IDE offers fast rebuild and hot deployment features that could speed up my work. However I'm running into a roadblock due to how my maven project is set up.
Constraints
I have to use maven the way it's being used. The solution must be in IntelliJ
Note that creating an IntelliJ plugin is an option. I realize this may be necessary due to the limitations of IntelliJ build configuration.
The problem
My project depends on 2 libraries, SharedLibA and SharedLibB, which contain package com.shared. SharedLibA is a new library, and sharedLibB is and old legacy one. SharedLibA and SharedLibB contain packages that are not contained in the other, which are needed by my project. The package they both have, com.shared is needed by the project too. However SharedLibB is legacy/old so we always want Tomcat to prioritize the implementation of classes in com.shared from SharedLibA, not the implementations of those classes in SharedLibB. We accomplish this by having a maven goal that extracts classes under package com.shared from SharedLibA to WEB-INF/classes when the WAR is packaged.
When I try to build my project in IntelliJ, it picks up the wrong implementation of classes in com.shared.* and spews out compilation errors despite compilation working perfectly via maven. I'm stuck with this inflexible maven hackjob but I still want to find a way to make IntelliJ understand that I want SharedLibA's com.shared.* classes to be used in compilation not SharedLibB's. I can't remove SharedLibB from consideration because I need the other classes in SharedLibB to compile my project.
Desired Solution
I'm looking for some kind of logic like "when com.shared.* classes are considered, choose SharedLibA" or "when any package conflict happens in classpath resolution, prioritize ShareLibA" because I'm pretty sure SharedLibA should be prioritized in any package conflict.
Thanks
I hope that explains it well enough, thank you in advance to anyone who chimes in here.
IDE builds the classpath and buildpath based on the dependencies which are configured for the module. It also considers their order - the 1st dependency that match given class will be used.
For Maven-based projects the dependencies list and their order IDE takes from the Maven pom.xml file of the module. So you can set the order in pom.xml file.
Another mentioned option is to exclude the library items. But the better solution would be to configure Maven build properly.
You should try to go to your project ".IML" file and there :
you can create or modify a module.
In there you can include or exclude the libs or defining its use priority
you could use this snippet to inspire
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="8">
<component name="SharedB" LANGUAGE_LEVEL="JDK_1_8">
<output url="file://$MODULE_DIR$/target/classes" />
<output-test url="file://$MODULE_DIR$/target/test-classes" />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
...
<excludeFolder url="file://$MODULE_DIR$/target" />
</content>
...
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
...
</component>
</module>
if you are not confortable with this solution you could use the module settings of Intellij
https://www.jetbrains.com/help/idea/library.html#excluded_lib_items

org.talend cannot be resolved

I downloaded one custom Talend component from Talend exchange. When I tried to run a job using this component, it gives org.talend cannot be resolved error. The component has required jars along with custComponent_message.properties, custComponent_begin.jet, custComponent_java.xml, custComponent.png files inside it. The CODEGENERATION part of custComponent_java.xml looks like this
<CODEGENERATION>
<IMPORTS>
<IMPORT NAME="bcprovider" MODULE="bcprov-jdk16-143.jar" REQUIRED="true" />
<IMPORT NAME="bcpg" MODULE="bcpg-jdk16-143.jar" REQUIRED="true" />
<IMPORT NAME="PGPEncrypt" MODULE="PGPEncrypt.jar" REQUIRED="true" />
</IMPORTS>
</CODEGENERATION>
Inside custComponent_begin.javajet there is this line that's where I am getting org.talend cannot be resolved error.
org.talend.pgp.PGPEncrypt.encryptFile(<%=source%>,<%=destination%>,<%=publicKey%>,<%=remove%>);
What am I doing wrong here? Do I need to save the jars in some other location too? Please help
The procedure for installing custom components is described here: https://help.talend.com/display/KB/How+to+install+external+modules+in+the+Talend+products
In essence, you should go to the Modules view (Window > Show views > Talend > Modules) and download and install needed modules from there.

What can cause Play modules to be loaded twice?

I am trying on the associations module, and it fails because it tries to enhance the same object twice. Debugging my test case, I discover that I have two instances of both this module and less-css module loaded! It appears that the play.plugins file is loaded as two resources:
file:/C:/work/CS/portal/src/modules/associations-1.0.1/lib/play-associations.jar!/play.plugins
jar:file:/C:/work/CS/portal/src/modules/associations-1.0.1/lib/play-associations.jar!/play.plugins
This causes the pluginsToLoad variable to contain two copies of this module, and everything goes haywire from here.
Is this a mis-configuration on my part? How can I investigate further / resolve?
The module only appears once in my dependencies.yml, and does not appear in application.conf
See here for a screenshot.
Update - it seems that the classpath contains:
C:\work\CS\portal\src\modules\associations-1.0.1\src;
C:\work\CS\portal\src\modules\associations-1.0.1\lib\play-associations.jar;
And a play.plugins file exist both in the src folder, and in the jar. Now I need to understand why both are in the classpath.
This happens if you put the module into your
dependencies.yml AND declare it as module in application.conf
remove the entry in application.conf
I believe this is a bug within play idealize. I found these entries in the iml file:
<library name="Project Libraries">
<CLASSES>
<root url="file://$MODULE_DIR$/lib" />
<root url="file://$MODULE_DIR$/modules/less-0.3/src" />
<root url="file://$MODULE_DIR$/modules/associations-1.0.1/src" />
<root url="file://$MODULE_DIR$/modules/less-0.3/lib" />
<root url="file://$MODULE_DIR$/modules/associations-1.0.1/lib" />
</CLASSES>
...
I've submitted a bug (the workaround is to manually remove the /src entries)
I had the same symptom, play modules being loaded twice.
I discovered it was a bug in the "play war" 1.2-beta2 plugin that was causing my main jar file to be created twice with slightly different names and then both be included in the "WEB-INF/lib" dir of my war file.
I upgraded the plugin to the latest 1.2-beta4 and it seems to have been fixed

Ant: Referencing dynamic properties

I want to use the same ant script to do a build in either my local windows environment or on our redhat build server.
I have a variable 'buildDirectory' in two files (build_unix.properties & build_windows). I want to set variables depending on the environment.
<osfamily property="os.family"/>
<property file="./build_${os.family}.properties" />
<property name="tmp-base.folder" value="${buildDirectory}/tmp/"/>
I also tried
<if>
<os family="unix"/>
<then>
<property file="./build_unix.properties" />
</then>
<else>
<property file="./build_windows.properties" />
</else>
</if>
Any ideas?
Are you asking how you can automatically set the os.family property in the first place?
If so, here's one approach:
<available file="C:\\" property="os.family" value="windows" />
<available file="/usr/bin/" property="os.family" value="unix" />
Ah! Edited question makes it more clear what you are asking (not this), and I see that you're using the "osfamily" task from ant-contrib to determine the OS family. But I'll leave this answer up for anyone who is just using ant without ant-contrib.
I would expect your if...then...else version to work. As it apparently isn't I would add some extra echo's to make sure your build is doing what you think it is doing.
An echo inside the then and the else would let you know for certain what path is being executed.
Add a prefix to the properties (e.g. <property file="..." prefix="test" />) and then add an <echoproperties prefix="test" /> to ensure the properties you think are being loaded are.
you can have two files : build-unix.properties and build-windows.properites and in your init target, you simply do a copy:
<copy file="build-${os.family}.properties" tofile="build.properties">
your main build.xml could simply reference the build.properties file.
This could be quite tricky to make it work properly so what I would do is to keep all properties of the build server in the build.properties file and allow local override (for your Windows box) in a build-local.properties. You can also move properties to a build-common.properties so that your build file would include the properties files in the following order
<property file="build-local.properties"/>
<property file="build-common.properties"/>
<property file="build.properties"/>

Java applet cached forever, not downloading new version?

We have a case where clients seem to be eternally caching versions of applets. We're making use of the <param name="cache_version"> tag correctly within our <object> tag, or so we think. We went from a version string of 7.1.0.40 to 7.1.0.42 and this triggered a download for only about half of our clients.
It doesn't seem to matter which version of the JRE the client is running. We've seen people have this problem on 1.4, 1.5 and 1.6.
Does anybody have experience with explicit cache versions? Does it work more reliably (ignoring speed) to instead rely on the cache_archive's "Last-Modified" and/or "Content-Length" values (as per Sun's Site)?
FYI, object block looks like this:
<object>
<param name="ARCHIVE" value="foo.jar">
<param name="CODE" value="com.foo.class">
<param name="CODEBASE" value=".">
<param name="cache_archive" value="foo.jar">
<param name="cache_version" value="7.1.0.40">
<param name="NAME" value="FooApplet">
<param name="type" value="application/x-java-applet;jpi-version=1.4.2_13">
<param name="scriptable" value="true">
<param name="progressbar" value="true"/>
<param name="boxmessage" value="Loading Web Worksheet Applet..."/>
</object>
Unfortunately, different versions of the Java Plug-In have different caching behaviors. Setting your Cache-Control and Last-Modified HTTP headers is the ideal solution, but it only works under the most recent versions of the JRE.
The only solution GUARANTEED to work is to rename your application jars when their versions change (we've seen strange caching behavior when trying other tricks like adding query strings based on file dates). This isn't so difficult to do if you have a properly automated deployment system.
You can remove applet from Java cache using Java Control Panel.
For example, on Win XP
Start -> Control Panel -> Java -> Temporary Internet Files[View]
As per this link
, same jar file should not be listed int "archive" and "cache_archive" params. In that case, the JAR file is cached using the native browser cache.

Categories