Eclipse runnable jar export misses some folders - eclipse

How I did the export:
select the project
right click > export...
Runnable JAR file
The problem:
The jar somehow misses folders in the project that is not under the src/.
I tried exporting as a regular Jar, in which I can select what files to be included. But after some searching, it seems there is no way to auto include dependencies not directly in the project (I'm using Maven and another external lib added by an eclipse plugin).
The "runnable jar" export apparently uses a launch profile to create the jar. I tried to tinker with the launch profile, but was unable to a setting to specify needed files/folders in the project for run.
I found a few articles about using Maven directly, with pom's maven-assembly-plugin to pack the jar without Eclipse. I did a quick digging, and it seems that's a bit raw. If it could be done directly in eclipse, that'd be great.

Related

Eclipse export runnable jar configuration

I am using the eclipse option to export a runnable jar from a project that I am editing. ( I have created some additional functionality through a plugin).
The runnable jar file works fine, except that is does not load the plugin I have created.
So ,I assume that I have to inform somehow eclipse to include the files I have created.
In other words,(forgive if I am asking something simple or obvious) how eclipse knows about the dependencies and all that staff ?
Since the project contained already an ant file for building and compiling ,I am wondering if this is what I have to tune.
Eclipse does not use the build.xml file to export jars. The dependencies information is kept in the .project file.
You can add your plugin as follows:
Right-click your project and select properties, then go to "Java Build Path" and select the "Libraries" tab. Add your jar here to get eclipse to recognize it as part of the project. Next go to the "Order and Export" tab. Select your jar-file here so it gets exported with the runnable jar.
When you build the jar file, make sure to select "Package required libraries into generated JAR" rather than "Extract required libraries into generated JAR". Unfortunately, I can't guarantee this will work. It sounds like rapidminer loads plugins by searching the libs directory. I don't know if it will be smart enough to recognize when it's running from a jar file and look inside the jar file it's running from rather than in the working directory.
If not, you'll have to ask your question to someone who knows about rapidminer.

How to deploy a JAR file with all required JAR files in Eclipse

Can someone please explain how do i compile an app to a JAR file that will include several other libraries?
I have included three JAR files that need to compile with application.
I have tried to go with "Export/Runable JAR File Export" as suggested, but the "Launch Configuration" dropdown is blank.
I tried Running the program and it runs fine, also if I check the "Run Configurations" all seem fine.
What am i missing?
I have downloade MAVEN plugin, converted the project to MAVEN project.
Then i included the POM.XML where i included all the dependencies and JAR signature.
The project is then exported as JAR file with MAVEN install command.

eclipse ant integration and code formatting

I have configured Eclipse to use ant for doing the builds by setting the builders in project properties to point to the ant build script.
The build goes thru fine. However in my eclipse project I have not imported the required jars as a part of the project settings. All of this is done in ant's build.xml.
So in the java files, I get red squiglly lines for all the import packages which eclipse is not able to resolve.
How do I make these squiglly lines go away? One way is to import the required jars in eclipse, but then I am maintaining the project at two places, ant build.xml and eclipse
go to Project Properties/Build Path and enter the jars you rely on there.
You could use Ivy to manage your dependencies. If you configure it properly, you will only be defining the jars in one place but both Eclipse and Ant will be able to see them. The eclipse plug-in is IvyDE.

NetBeans -- Is it possible to bypass the IDE-generated Ant build for an existing project?

I have a Java project with sub-projects that is currently built using NetBeans's IDE-generated Ant scripts. I am converting the entire project to a Maven build.
My Maven build works fine from the command line and loads perfectly in Eclipse. However, the only way I can get the project to load as a Maven project in NetBeans is to delete the Ant scripts, i.e. build.xml and the directory nbproject for each sub-project. It seems that as long as I have the old IDE-generated build files, NetBeans recognizes the project as a NetBeans Java project only, not as a Maven Java project, even though there is also a pom.xml file present.
Short of deleting the IDE-generated build files, is there any way to tell NetBeans to load the project as a Maven project?
I have been told that we want to keep the Ant build for a while during the transition to Maven.
Using NetBeans 6.9.1, Maven 2.2.
Any help would be appreciated.
Thanks
Well, the nb ant project metadata has precedence over occurence of pom.xml file (that's how maven projects are recognized and loaded). The whole precedence order hardwired in the IDE, you could only influence it be uninstalling the j2se ant project type for example.
So, yes. You need to get rid of the ant project metadata before you can open the project as maven project. Depending on how and when you delete the metadata, you might need to restart the IDE as well to get the new stuff loaded.
Have you seen http://wiki.netbeans.org/MavenBestPractices? It indicates that you must install the NetBeans maven plugin first. Perhaps that's why your Maven projects aren't recognized.
I must note that I'm not a NetBeans user anymore!
Here is what I ended up doing:
I wrote an Ant script (ironic, huh?) that, for every subproject of my project, renames the file nbproject/project.xml if it exists to nbproject/nb_project_disabled.xml. If nbproject/nb_project_disabled.xml exists instead, the script renames it back to nbproject/project.xml. In this way, the script toggles the opening of the project as a NetBeans Ant build or as a Maven build.
It would be nice if NetBeans, you know, had a setting to open both kinds of projects. Currently (6.9.1), there is just the "Open Project" command. In Eclipse, there is the command "Import Existing Maven Projects" vs. "Import Existing Project Into Workspace" (i.e. native Eclipse format).

Maven project is in a subfolder, can't get Eclipse integration to work

Inside the folder 'ProjectName' exists several subfolders, and of them contains java program:
ProjectName
Specifications
JavaCode
Gfx
...
JavaCode folder contains pom.xml.
I have installed m2eclipse (0.10.x) to Eclipse and imported whole ProjectName folder to Eclipse. Subfolders are displayed correctly but maven integration is not working correctly - for example I don't see src/main/java "shortcut" folder in Eclipse, but I have to click to open all folders.
If I create a new maven project with Eclipse from scratch, the integration works well.
What could be the issue?
Select the JavaCode folder and then invoke File... / Import... / Maven Project. That would bring your Java code into Eclipse as a proper project with Maven support enabled. It is fine to import several overlapping folders. So, you could use the parent for version control purposes and JavaCode would be the actual Java project you'd work with in the IDE.
Unfortunately there is no way around that, unless you want to move your pom.xml to the root project and remap all the Maven plugins to folders under JavaCode project. But that would be really bad idea and Maven integration for Eclipse may not work with such project structure without an additional tweaking.