I created a new Dynamic Web Project in Eclipse Kepler, and as it's my first time using IvyDE, I put some dependencies to test it out. here is my ivy.xml:
<ivy-module version="2.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://ant.apache.org/ivy/schemas/ivy.xsd">
<info
organisation="net.myorg"
module="mymodule"
status="integration">
</info>
<dependencies>
<dependency org="org.hibernate" name="hibernate-entitymanager" rev="4.2.3.Final"></dependency>
<dependency name="log4j" rev="1.2.17" org="log4j"></dependency>
</dependencies>
</ivy-module>
The dependencies where resolved and I can see them in the project libraries.
But after this, my project started giving this warning:
Description Resource Path Location Type
Classpath entry org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?project=myproject&ivyXmlPath=ivy.xml&confs=*&acceptedTypes=jar%2Cbundle%2Cejb%2Cmaven-plugin&alphaOrder=false&resolveInWorkspace=true&retrievedClasspath=true&retrievedClasspathPattern=lib%2F%5Btype%5Ds%2F%5Bartifact%5D-%5Brevision%5D.%5Bext%5D&retrievedClasspathSync=true&retrievedClasspathTypes=* will not be exported or published. Runtime ClassNotFoundExceptions may result. myproject P/myproject Classpath Dependency Validator Message
So if I am understanding it right, Eclipse is warning me that the IvyDE entry in the classpath don't correspond to a resource that will be in the builded project. I suppose this is the expected behavior, if so, is there a way to remove this warning from the project, without disabling every Classpath Dependency Validator Message
?
The reason for the warning message is that the Eclipse flexible project deployment mechanism doesn't know whether or not to deploy the libraries referenced by the Ivy container. So you need to explicitly tell it which you want to do, deploy the jars to WEB-INF/lib or not.
If you need this container deployed to WEB-INF/lib you need to:
If you look into the .classpath settings file you will see this adds an entry like this:
<classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?project=ivy-test-portlet&ivyXmlPath=ivy.xml&confs=*&ivySettingsPath=%24%7Bliferay_sdk_dir%3Aivy-test-portlet%7D%2Fivy-settings.xml&loadSettingsOnDemand=false&ivyUserDir=%24%7Bliferay_sdk_dir%3Aivy-test-portlet%7D%2F.ivy&propertyFiles=">
<attributes>
<attribute name="org.eclipse.jst.component.dependency" value="/WEB-INF/lib"/>
</attributes>
</classpathentry>
Notice the <attributes>...</attributes>
element has been added. Also my Ivy container path will be different than yours as this is a Ivy container path for one of my own projects.
Now if you don't need to deploy these libraries contained in the Ivy container to your runtime, then you need to tell Eclipse that there is no dependency on these libraries at runtime. You can do that by adding the appropriate attributes in the .classpath file.
The final element will look something like this. Your path will have different options but the key part is the attributes child element:
<classpathentry kind="con" path="org.apache.ivyde.eclipse.cpcontainer.IVYDE_CONTAINER/?project=ivy-test-portlet&ivyXmlPath=ivy.xml&confs=*&ivySettingsPath=%24%7Bliferay_sdk_dir%3Aivy-test-portlet%7D%2Fivy-settings.xml&loadSettingsOnDemand=false&ivyUserDir=%24%7Bliferay_sdk_dir%3Aivy-test-portlet%7D%2F.ivy&propertyFiles=">
<attributes>
<attribute name="org.eclipse.jst.component.nondependency" value=""/>
</attributes>
</classpathentry>
Either one that you choose, you have explicitly told Eclipse how to handle this library container dependency during deployment. So now you can re-validate the project (right click project and choose "Validate") and you should see the error go away.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With