Ivy error while building a project in netbeans - java

I am an Ivy newbie and I need some help resolving an error. When I try to build my project using netbeans it gives me following error :
confs: [compile, runtime, compile-test, runtime-test]
C:\Users\Tejas\Documents\NetBeansProjects\LaitsV3\Laitsv3second\nbproject\ivy-impl.xml:92: impossible to resolve dependencies:
java.io.FileNotFoundException: C:\Users\Tejas\.netbeans\7.1.1\modules\ext\ivy-2.1.0.jar\cache\resolved-Laitsv3second-Laitsv3second-1.0.xml (The system cannot find the path specified)
where as this Laitsv3second-Laitsv3second-1.0 is being picked up by ivy from ivy.xml file's info tag as follows :
<ivy-module version="2.0">
<info organisation="Laitsv3second" module="Laitsv3second" revision="1.0" />
Can anybody help me identifying this problem? or any pointer for help?

I resolved this error by adding following to the ivysetting
<property name="ivy.default.ivy.user.dir" value="${user.home}/.ivy2" />
<caches resolutionCacheDir="${user.home}/.ivy2/cache" defaultCacheDir="${user.home}/.ivy2/cache"/>
this way it tries to find the cache in the specified directory. Otherwise it tries to find the cache in the ivy.jar file. This may sound stupid but it is what happens.
This is the same problem as reported on ivvybeans forum but it is unresolved yet. https://code.google.com/p/ivybeans/issues/detail?id=103

It works for me too, here is my ivysetting looks like:
<ivysettings>
<settings defaultResolver="main" >
<property name="ivy.default.ivy.user.dir" value="${user.home}/.ivy2" />
<caches resolutionCacheDir="${user.home}/.ivy2/cache" defaultCacheDir="${user.home}/.ivy2/cache"/>
</settings>
<resolvers>
<chain name="main">
<url name="repo" m2compatible="true">
<artifact pattern="http://reposserver/artifactory/repo/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).[ext]" />
<ivy pattern="http://reposerver/artifactory/repo/[organization]/[module]/[revision]/[module]-[revision](-[classifier]).pom" />
</url>
<ibiblio name="compass" m2compatible="true" root="http://repo.compass-project.org"></ibiblio>
<ibiblio name="ibiblio" m2compatible="true"></ibiblio>
</chain>
</resolvers>
</ivysettings>

Related

No Persistence provider for EntityManager named- when try to deploy from weblogic console

I'm struggling for a few days about this error.
When I try to deploy from ide(IntelliJ-eclipse), it works correct.
But when I try to deploy from WebLogic console, I got these errors;
Error Unable to access the selected application.
Error Unable to invoke Annotation processoror.
Error Unable to invoke Annotation processoror.
For more information, I checked logs and errors from stack trace.
It looks like the main error is: javax.persistence.PersistenceException: No Persistence provider for EntityManager named.
In debug, throwing from this code; Persistence.createEntityManagerFactory("persistanceUnitName");
Persistence classes are coming from javaee-web-abi-7.0.jar.
Everything looks fine in persistence.xml.
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="persistanceUnitName"
transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>dataSource</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.target-database" value="Oracle" />
<property name="eclipselink.logging.parameters" value="true" />
<property name="eclipselink.logging.logger" value="DefaultLogger" />
<property name="eclipselink.logging.level" value="WARNING" />
<property name="eclipselink.refresh" value="true" />
<property name="eclipselink.query-results-cache" value="false" />
<!-- <property name="eclipselink.ddl-generation" value="create-or-extend-tables" />-->
</properties>
</persistence-unit>
</persistence>
persistance.xml located in /WEB-INF/classes/META-INF
We got a case like that: we have a test and prep environment. In test, it works, in prep doesn't work, in local doesn't work (from WebLogic console). Unfortunately, I can't see test server configs. But I expect the same options with prep. Anyway forget other environments, firstly I need to deploy successful from local.
Could you pls help me, I really don't know what I miss. Read every topic, tried everything
It looks like a classpath issue. Check your weblogic classpath.
If you are using eclipselink library must be loaded first when you are deploying.
Check this.
Add eclipselink into your project with scope provided:
<dependency>
<groupId>org.eclipse.persistence</groupId>
<artifactId>eclipselink</artifactId>
<version>2.5.0</version>
<scope>provided<scope>
</dependency>
add same dependency into your weblogic classpath:
$WEBLOGIC_HOME/user_projects/domains/base_domain/lib
Then, add below to your weblogic.xml to use eclipselink library.
<wls:container-descriptor>
<wls:prefer-application-packages>
<wls:package-name>org.eclipse.persistence.*</wls:package-name>
</wls:prefer-application-packages>
</wls:container-descriptor>

Intellij Default SDK Unused Path Issue

I try to set the default sdk to C:\Program Files\Java\jdk1.8.0_144. It works fine, but when i open the project again it changes to a Python path which doesn't exist anymore. On Platform Settings SDKs there is not any Python path too.
How can i remove this path and let the Java JDK be the default sdk?
Edit: I think i found the problem, but i don't know how can i fix it. Here is a component of the project.default.xml file
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="Python 3.5.2 (C:\Users\Adam\AppData\Local\Programs\Python\Python35-32\python.exe)" project-jdk-type="Python SDK" />
<component name="PropertiesComponent">
<property name="project.structure.last.edited" value="Project" />
<property name="project.structure.proportion" value="0.15" />
<property name="project.structure.side.proportion" value="0.2" />
<property name="settings.editor.selected.configurable" value="reference.projectsettings.compiler.javacompiler" />
<property name="nodejs_interpreter_path" value="C:/Program Files/nodejs/node" />
<property name="JavaScriptPreferStrict" value="false" />
<property name="JavaScriptWeakerCompletionTypeGuess" value="true" />
</component>
Check project's .idea/misc.xml there are some configs of your project. Also check this and go to options\jdk.table.xml. If you won't find anything strange there, then it's better to report this on the JetBrains Issue tracker
I have fixed it with the help of #Russiancold's answer. I edited the project.default.xml file.
first removed this component
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="Python 3.5.2 (C:\Users\Adam\AppData\Local\Programs\Python\Python35-32\python.exe)" project-jdk-type="Python SDK" />
then added this component
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK" />

Parsing xml property to ant-build.xml file

I have a xml file "versionreferance.xml". below is the coding
<?xml version="1.0" encoding="utf-8"?>
<!-- Update "revision" value to -1 when the next build is intended to have its revision as 0. This needs to be done for patch/release builds-->
<BuildVersions>
<property name="major" value="1" />
<property name="minor" value="0" />
<property name="patch" value="0" />
<property name="revision" value="93" />
</BuildVersions>
The other is my ant-build.xml file.
<?xml version="1.0" encoding="UTF-8"?>
<project name="xmlproperty-demo" default="init">
<xmlproperty file="versionreferance.xml" collapseAttributes="true" />
<echo>Major : ${BuildVersions.major}</echo>
<echo>Minor : ${BuildVersions.minor}</echo>
<echo>Patch : ${BuildVersions.patch}</echo>
<echo>Revision : ${BuildVersions.revision}</echo>
</project>
I am not getting the value in the output.
I want to get the path path dynamically of versionReference.xml , which will be in different place than antbuild.xml
Development\Build\VersionReference.xml
Development\Src\JAAS API\antbuild.xml
It should be dynamically. I am able to get the values form below code. But it's not dynamic.
<?xml version="1.0" encoding="UTF-8"?>
<project name="xmlproperty-demo" default="init">
<xmlproperty file="C:\\Development\\Build\\versionreferance.xml" collapseAttributes="true" />
<echo>Major : ${BuildVersions.major}</echo>
<echo>Minor : ${BuildVersions.minor}</echo>
<echo>Patch : ${BuildVersions.patch}</echo>
<echo>Revision : ${BuildVersions.revision}</echo>
</project>
I want to get the values only in this format.
<?xml version="1.0" encoding="utf-8"?>
<!-- Update "revision" value to -1 when the next build is intended to have its revision as 0. This needs to be done for patch/release builds-->
<BuildVersions>
<property name="major" value="1" />
<property name="minor" value="0" />
<property name="patch" value="0" />
<property name="revision" value="93" />
</BuildVersions>
I highly recommend using the free, third-party XmlTask library:
build.xml
<taskdef name="xmltask" classname="com.oopsconsultancy.xmltask.ant.XmlTask" />
<xmltask>
<fileset file="versionreferance.xml"/>
<copy path="/BuildVersions/property[#name = 'major']/#value" property="BuildVersions.major"/>
<copy path="/BuildVersions/property[#name = 'minor']/#value" property="BuildVersions.minor"/>
<copy path="/BuildVersions/property[#name = 'patch']/#value" property="BuildVersions.patch"/>
<copy path="/BuildVersions/property[#name = 'revision']/#value" property="BuildVersions.revision"/>
</xmltask>
<echo>Major : ${BuildVersions.major}</echo>
<echo>Minor : ${BuildVersions.minor}</echo>
<echo>Patch : ${BuildVersions.patch}</echo>
<echo>Revision : ${BuildVersions.revision}</echo>
Output
run:
[echo] Major : 1
[echo] Minor : 0
[echo] Patch : 0
[echo] Revision : 93
If you add <echoproperties/> after the <xmlproperty> line you should see the properties are loaded but not as you expect. They will be something like:
BuildVersions.property=,,,
BuildVersions.property.name=major,minor,patch,revision
BuildVersions.property.value=1,0,0,93
This is because the properties are based off the node names, and in your case you have four instances of a "property" child node that are not unique. Your best bet may be to change the xml such as:
<BuildVersions>
<major>1</major>
....
</BuildVersions>
When you say xmlproperty with collapseAttributes="true" on xml file, it will flatten nested elements.
Details: https://ant.apache.org/manual/Tasks/xmlproperty.html
So just saying ${BuildVersions.major} doesn't give or print value as 1. Since you have same named xml element 'prooerty' you won't be able to get single propertie's value
For eg, in your case ${BuildVersions.property.name} will print 'major,minor,patch,revision'
Either you can redesign your versionreferance.xml to respect xmlproperty to work . Or you can make it as property file & say <property file="your.properties.file"/> & access them as normal properties!
If VersionReference.xml is going to be exactly where you mentioned in your question corresponding to your antbuild.xml.
I would suggest you to change your Absolute Path (as mentioned in question) with "..\..\Build\VersionReference.xml" which corresponds to the basedir="." in your project
This should work fine.
And considering your string format requirement.
I think the default comma(,) seperated value can then be replaced by dot(.) or manipulated as per your requirement by the following syntax
<propertyregex property="propB"
input="${propA}"
regexp=","
replace="."
global="true" />
Please find more info on this link :
Replacing characters in Ant property
Hope this helps.

How to ignore "id" in Short Variable rule using PMD

I am using PMD plugin (version 4.0.2) for Eclipse (Eclipse Kepler Java EE). I have configured a naming rule: ShortVariable.
This works fine except for parameters like "id" and "e". I want PMD to ignore these. So I searched for a way to ignore certain parameters. I found this link (although it's for phpmd) and tried it, yet I can't seem to get it working. My config file looks like this (XML):
<?xml version="1.0"?>
<ruleset name="My PMD ruleset"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
My PMD
</description>
<rule ref="rulesets/java/naming.xml/ShortVariable">
<property name="exceptions" value="id" />
</rule>
</ruleset>
When I try to import this ruleset using the eclipse plugin, it shows no possible rules to import.
Any ideas?
I found a solution to my problem here.
The resulting xml looks like this:
<?xml version="1.0"?>
<ruleset name="My PMD ruleset"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
<description>
My PMD
</description>
<rule ref="rulesets/java/naming.xml/ShortVariable">
<properties>
<property name="xpath">
<value>
//VariableDeclaratorId[(string-length(#Image) < 3) and (not (#Image='id'))]
[not(ancestor::ForInit)]
[not((ancestor::FormalParameter) and (ancestor::TryStatement))]
</value>
</property>
</properties>
</rule>
</ruleset>
To be able to ignore more variable names, repeat the following part:
and (not (#Image='myVariableToIgnore'))
The folowing XML is valid for PHP tool PHPMD 2.2.3
<?xml version="1.0"?>
<!DOCTYPE ruleset>
<ruleset
name="My PMD ruleset for symfony 2.5"
xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd"
>
<rule ref="rulesets/unusedcode.xml" />
<rule ref="rulesets/codesize.xml" />
<rule ref="rulesets/cleancode.xml" />
<rule ref="rulesets/controversial.xml" />
<rule ref="rulesets/design.xml" />
<rule ref="rulesets/naming.xml">
<exclude name="ShortVariable" />
</rule>
<rule ref="rulesets/naming.xml/ShortVariable">
<properties>
<property name="exceptions" value="id,em" />
</properties>
</rule>
</ruleset>
Update xml
<rule ref="category/java/codestyle.xml/ShortVariable">
<properties>
<property name="xpath">
<value>
//VariableDeclaratorId[(string-length(#Image) < 3) and (not (#Name='id'))]
[not(ancestor::ForInit)]
[not((ancestor::FormalParameter) and (ancestor::TryStatement))]
</value>
</property>
</properties>
</rule>

appengine-web.xml - XML error validating

when I try to deploy my App Engine Project, the following Valditation Error is shown:
An internal error occurred during: "Deploying Guestbook to Google".
XML error validating C:\Users\Adrian\workspace\Guestbook\war\WEB-INF\appengine-web.xml against C:\eclipse\plugins\com.google.appengine.eclipse.sdkbundle_1.5.0.r36v201105092302\appengine-java-sdk-1.5.0\docs\appengine-web.xsd
Here is my appengine-web.xml:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>adrianschaeferandroid</application>
<version>1</version>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties" />
</system-properties>
<static-files>
<include path="/favicon.ico" />
</static-files>
<static-files>
<include path="stylesheets/main.css" />
</static-files>
</appengine-web-app>
Can anyone see the Validation Error? Shall I post the appengine-web.xsd?
you can only have 1 static-files element. if you have multiple include, you should nest them all within a static-files element.
thus the correct appengine-web.xml should be:
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>adrianschaeferandroid</application>
<version>1</version>
<system-properties>
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties" />
</system-properties>
<static-files>
<include path="/favicon.ico" />
<include path="stylesheets/main.css" />
</static-files>
</appengine-web-app>
You will find it a lot easier to not make such errors if you configure your app GAE/Java app using an app.yaml file to generate both the web.xml and appengine-web.xml: https://developers.google.com/appengine/docs/java/configyaml/appconfig_yaml

Categories

Resources