generated-source folder not created in Java project - java

I created a java project using sbt. While I was trying to use an Immutable class using #Value.Immutable annotation I noticed that generated-source folder is not created. Instead, I see the structure :
I also updated Build, Execution and Deployment section, ran sbt clean then sbt compile. I still don't see the generated-sources folder.
Any naive mistake I am making?
Should scala target directory even be created because its a java play framework project?

Related

ClassNotFound exception after renaming package

I have a Spring Boot application in which I renamed package where starting class is in. Application runs without any problem when launching from IDE (Spring Tools Suite) but when I build it with maven and run from command line with
java -jar <application_name.jar>
It says that class in old_package cannot be found. Things I've tried so far:
Clean project
Delete metadata from workspace
Copy project somewhere else and import it from there
Deleting Run Configuration and creating new one with main class in new package.
I also unzipped jar located in target folder and checked its manifest file and Start-Class param is set to old package.
You didn't update your pom.xml, and it contains references written in the form <old_package>.MyClass, whereas this should be <new_package>.MyClass. Your IDE (I'm not an expert with STS though) uses its own rules for compilation, so your program can run in it.

multi project java build with gradle

I've decided to use gradle instead of ant in some of my applications.
the folder structure for my apps is:
<appname>
---java
------build.gradle
------settings.gradle
------sourcefolder1
------sourcefolder2
------sourcefolder3
---------------subsourcefolder1
---------------subsourcefolder2
I take the compilation files for every application and create a single jar that contains them all.
My issue is as follows:
There is no code to compile under the java folder, only under its subdirectories which are sub-projects in gradle. So, I apply the java plugin only for the sub-projects. In this case everything compiles fine but the final jar to contain everything doesn't get created. On the other hand, if I apply the java plugin to the rootProject it starts compiling the source folders although they have a uniqe project of their own.
I tried applying the java plugin to the root project and overriding compileJava task to do nothing - but it created an empty jar, probably this task also generates the products to jar.
Is there an elegant solution for this?
Thanks.

Bringing Groovy code to the src folder in Eclipse

Groovy code in project structure is src/groovycode/src/packagename and rest of the java classes are in src/packagename. My other team member use IntelliJ and it seamlessly compiles groovy classes into java classes with desired package names and ignores groovycode/src folder. I am not able to do same in Eclipse and compile groovy classes at all. So I end up copying groovy class from others and copying into my WEB-INF/classes folder.Is there any way to achieve this in Eclipse?
In between I am using Eclipse Helios and have Groovy Eclipse plugin installed.
It sounds like you have not set src/groovycode/src as a source folder. You need to right click on the source folder and select Build path -> Use as source folder. Once you do that you should open up your Java build settings page for the project and set the output folder for that source folder.
I would also recommend that you upgrade to Eclipse Indigo or Juno and start using Groovy-Eclipse 2.7.0.

creating project in eclipse

I want to create a project in eclipse in which the following directory gets generated automatically.
src/
tests/
projects.xml
meta-src/
So under which category this project will be falling. I was creating maven project. But it will be having lot more directories. So is there any specific project under which this will be falling? Or I can simply do Java project and keep on adding necessay files and directories?
Java project should be fine, you can set up auto-save actions etc no matter what the project type I believe.

Avoid ant and build automatically instead via eclipse.Is it possible?

I have let's say 4 eclipse projects.
Each references some other until one contains the actual main application.
Meaning that the idea is that each eclipse project is meant to be a library for a main application.
Each eclipse project references some other libraries e.g. spring, commons etc.
My question is the following:
I could write I guess some ant script that copies all the jars to a directory and builds the projects until we get the deliverable that has the classpath configured but is it possible to do something like this automatically via Eclipse?
I tried for example to do export as runnable jar and did not work.
All the referenced jar was not exported.
So is there some automatic way via eclipse or is ant the only option?
UPDATE:
I have no problem running the application inside Eclipse.The main eclipse project has references to the other projects it needs. My problem is the delivery of the application.
I.e. some runnable jar that runs standalone
Yes, you can do this, and you don't have to export any jars. When you modify the build path in eclipse (Build Path --> Properties), there is a section for referenced projects. Add the projects you need to reference to the main project and eclipse will treat them as dependencies.

Categories

Resources