Please guide since i wanted to understand on the build tool maven 'directory structure' intelli j as IDE where main/test divided into two separate folders but both have the same files.
Ps- I recently moved into QA automation so want to understand it better.
FYI per maven main website:
a. The main directory is the root directory for source code related to the application itself, not test code.
b. The test directory contains the test source code.
Maven search for the files in the below directory structure.
src/main/java - Source Java files
src/main/resources - Source resource files
src/test/java - Test cases
src/test/resources - Test resource files
Maybe this site would be helpful to you: https://maven.apache.org/guides/introduction/introduction-to-the-standard-directory-layout.html
Maven uses a strict folderstructure. Are you sure, that there are the same files in the folders? As Bhargav Kumar R mentioned before, in the test-folder there will be your test-classes, in the resource-folder there will be the resources for your tests.
Related
I am writing an automated testing project for school using maven and I need to implement CI to our project. Since Gitlab has its own CI, I decided to use it.
The problem is that the project itself is inside of a folder in a Gitlab repository. I created a branch for that project, but the branch main body includes the project folder, so when I create a gitlab-ci.yml file, it cannot find the POM.xml file in the folder. So my question is that is there a way to make the yml file recognize the POM file by adding some sort of variable to it?
I know there are "only:" and "changes:" keywords for the yml file but that doesn't seem like it will help recognize the pom file. Also manually pushing a yml file that is inside of the project folder does not help. I haven't tried moving the POM file because the project grade is also dependent on the quality of our commits, so I would rather not commit wildly.
Using
- mvn -f project/pom.xml compile
instead of -mvn compile in the build: section of the .yml file solved it for me. I was blind and didn't see that there was a help section in the log that already answered my question.
I have a legacy app that I'm porting from Ant to Maven. My Maven build works fine for the main project, which I've moved into the standard Maven directory layout (*.java files in /src/main/java/) and it outputs the compiled classes into /target/classes/ as neat as you could wish. These are packaged in a .war file.
However, the project also has a class outside of the folder hierarchy, indeed outside of the web application, that contains scripts that run via cron job. Let's say it's /cronjobs/MyClass.java. I need that class to be compiled and output to /target/cronjobs/MyClass.class and zipped up as part of the resulting .war file, in its /cronjobs/ folder.
Can Maven do this? I know it's possible to change the default "src" directory and "target" directory, but I don't know if (or how) it's possible to run a separate, parallel compile step for just one class.
I can move the source file, of course, if it's easier to compile it with the other classes and then move it later (maybe with the WAR plugin?) but I definitely need the compiled MyClass.class file in the /cronjobs/ directory of the .war.
I'd split the project in 2 parts, webapp as war and cronjobs as jar. Maven knows about multi-module format and it is somewhat the best way to go forward and decouple the webapp from non-webapp code.
I have a very specific question. The project I am on is a maven3 driven multi-module Project. The Project uses the SVN-Api to synchronize data from a repository and process it. More specifically:
A Manager, upon recieving an update call, will contact a remote svn repository and sync the files to the harddrive, where it will afterwards process them.
I want to create an appropriate folder Structure, with the assembly plugin. When I run a package command, ideally the output in the target folder would be
target
- data <- this is the base folder for the external repository
--- .svn <-- repository-information
--- group1 <-- subfolders on repository
--- group2
--- group3
- program.jar <-- contains java classes, executable
- config.xml <--- config file, editable by user
- other miscalleanous files
So frankly, this poses a number of problems and on top of this, I don't have too much experience with the assembly plugin. What I am not quite getting is how I am able to differentiate between files that should be put into the jar and files that should be kept outside the jar.
I have read about the assembly descriptors, I have however only seen examples that either include or exclude files, none that provide information about the relative positions the files should later have in the target folder.
Thanks for your time.
Regards,
Keno
So after some research I decided to go the following (simple) way:
At startup, The program fetches the location it's jar file is at, then checks for an resource folder outside the char. If none is found, it checks out the base directory of the svn server and starts crunching numbers. This way didn't require any fiddeling with the maven pom, and it works for testing as well.
I am trying to write Ant scripts to build jar files for Oracle ADF application and I noticed some differences in the contents being generated by the build (deploy might be a better word actually) process within JDev and from the Ant process:
META-INF/adfc-config.xml
META-INF/adflibWEBINDEX.txt
META-INF/adfm.xml
META-INF/faces-config.xml
META-INF/jar-adf-config.xml
META-INF/jar-connections.xml
META-INF/jax-ws-catalog.xml
META-INF/oracle.adf.common.services.ResourceService.sva
META-INF/task-flow-registry.xml
Does anyone know how these files are generated and how to edit the Ant scripts to include them?
I know that some of these exist in the project folder structure but when I compare their contents against the same files generated from the Jdev build produced jar file they are different. So I assume there is something more than a simple copy going on here.
Cheers,
Mo
Your best bet is to use "Create buildfile from project" in JDeveloper. This will produce the calls to ojdeploy necessary to create/update all the extra artifacts.
http://www.oracle.com/technetwork/articles/adf/part4-098813.html
For my OSGi development i have setup a target definition (.target file) which references two directories. Eclipse picks up all the jar files inside these directories and adds them to the target platform. But one of the bundles i have is a WAR file (.war extension) which is run using pax-web. Eclipse doesn't show this in the list of bundles available. Is there any way to add a particular bundle directly into the target definition? Any way out that i might be missing?
One workaround i found was to rename the .war file to .jar. Pax-web doesn't care about the extension, eclipse picks it up and so everything runs fine. But i am not very convinced if this is the right solution.
Thanks.
Bug 355890 was fixed for 3.8/4.2. You can now include archive files that are not jars (i.e. WAR files).
There is a known bug filed on eclipse on this very issue. Until it is fixed, the only workaround is to rename the file to have the .jar extension.
https://bugs.eclipse.org/bugs/show_bug.cgi?id=355890