How build JBoss Developer Studio from source? - java

Ciao,
Anyone tried to build JBoss Developer Studio from the source-zip available at (requires free reqistration)
JDBS source-zip
?
In the /build-directory, if I just do
mvn clean install
it will complaint about missing child-projects.
So I found the comment in the pom:
<!-- for bootstrapping the parent and target-platform poms via Mead, we need to be able to fetch from this folder and run
this profile (excluding all others); currently parent pom includes target-platform build too, so only need to build the parent
mvn clean install -P parent,\!libs,\!tests,\!jmx,\!archives,\!as,\!common,\!jst,\!xulrunner,\!vpe \
-P \!jsf,\!freemarker,\!hibernatetools,\!portlet,\!struts,\!cdi,\!birt,\!seam,\!examples \
-P \!maven,\!ws,\!gwt,\!deltacloud,\!runtime,\!usage,\!central,\!aggregate-coverage
-->
and tried that mvn-command, but then it complaints:
Child module .\parent\..\target-platform of .\parent\pom.xml does not exist
I never used Mead, and dont understand that stuff about boot-strapping and target-platform...
Anyways, what is the proper way to make this build work?

Frankly, no one's ever asked for it.
Building JBDS 6 is a three-step process:
build JBoss Tools component projects from github sources (mostly just fetching sources from git, then mvn clean install
build JBoss Tools aggregate site from github sources (fetch sources from https://github.com/jbosstools/jbosstools-build-sites )
build JBDS aggregate site + installer from SVN sources (fetch sources from SVN or use source zip)
I've opened a JIRA for this request:
https://issues.jboss.org/browse/JBDS-2456

Related

when i add apache deryby dependecy it gives error [duplicate]

I imported my already working project on another computer and it started to download dependencies.
Apparently my internet connection crashed and now I get the following:
>Build errors for comics; org.apache.maven.lifecycle.LifecycleExecutionException:
Failed to execute goal on project comicsTest: Could not resolve dependencies for project comicsTest:comicsTest:war:0.0.1-SNAPSHOT:
The following artifacts could not be resolved:
org.springframework:spring-context:jar:3.0.5.RELEASE,
org.hibernate:hibernate-entitymanager:jar:3.6.0.Final,
org.hibernate:hibernate-core:jar:3.6.0.Final,
org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final,
org.aspectj:aspectjweaver:jar:1.6.8,
commons-lang:commons-lang:jar:2.5,
>mysql:mysql-connector-java:jar:5.1.13: Failure to transfer org.springframework:spring-context:jar:3.0.5.RELEASE from http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced.
>Original error: Could not transfer artifact org.springframework:spring-context:jar:3.0.5.RELEASE from central (http://repo1.maven.org/maven2): No response received after 60000
How do I force maven to update?
mvn clean install -U
-U means force update of snapshot dependencies.
Release dependencies will be updated this way if they have never been previously successfully downloaded. ref: https://stackoverflow.com/a/29020990/32453
If your local repository is somehow mucked up for release jars as opposed to snapshots (-U and --update-snapshots only update snapshots), you can purge the local repo using the following:
mvn dependency:purge-local-repository
You probably then want to clean and install again:
mvn dependency:purge-local-repository clean install
Lots more info available at https://maven.apache.org/plugins/maven-dependency-plugin/examples/purging-local-repository.html
-U seems to force update of all SNAPSHOT dependencies.
If you want to update a single dependency without clean or -U you could just remove it from your local repo and then build.
The example below if for updating slf4j-api 1.7.1-SNAPSHOT:
rm -rf ~/.m2/repository/org/slf4j/slf4j-api/1.7.1-SNAPSHOT
mvn compile
All the answers here didn't work for me. I used the hammer method:
find ~/.m2/ -name "*.lastUpdated" | xargs rm
That fixed the problem :-)
You can do effectively from Eclipse IDE. Of course if you are using it.
Project_Name->Maven->Update Project Configuration->Force Update of Snapshots/Releases
Just in case someone wants only update project's snapshot dependencies and doesn't want to install artifact:
mvn dependency:resolve -U
Don't forget to reimport dependencies in your IDE. In IDEA you need to right click on pom file and choose Maven -> Reimport
If you're unsure what is inside your local repository, I recommend to fire a build with the option:
-Dmaven.repo.local=localrepo
That way you'll ensure to build in a cleanroom environment.
In my case first I did was:
mvn clean install -U
Still it was showing same error then I closed project and again reopened it. Finally worked.
If you are using eclipse IDE then :
Select Project.
Press alt+F5, window for Update Maven Project will pop up.
Check - Force Update of Snapshots/releases and click OK.
If Using Intellij IDE
go to settings/Maven
check Always update snapshots
I used the IntelliJ IDE and I had a similar problem and to solve I clicked in "Generate Sources and Update Folders for All Projects" in Maven tab.
Previous versions of maven did not force the check for missing releases when used -U with mvn clean install, only the snapshots, though newer version supports this.
For someone still struggling with previous version, following can be helpful-
On Windows:
cd %userprofile%\.m2\repository
for /r %i in (*.lastUpdated) do del %i
On Linux:
find ~/.m2 -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;
Whenever maven can't download dependencies for any reason (connectivity/not exists etc), it will add the ".error=Could not transfer artifact" in dependency-name.lastUpdate file in respective folder under $home/.m2 directory. Removing these files will force maven to try fetching the dependencies again.
mvn clean install -e -U -Dmaven.test.skip=true
-e Detailed exception
-U forced update
-DskipTests does not execute test cases, but compiles test case classes to generate corresponding class files under target/test classes.
-Dmaven.test.skip=true, do not execute test cases or compile test case classes.Using maven. test. skip not only skips running unit tests, but also skips compiling test code.
A small suggestion. If you use the IntelliJ Idea compiler, it is recommended to clean the cache
I've got the error in an other context.
So my solution might be useful to others who stumple upon the question:
The problem:
I've copied the local repository to another computer, which has no connection to a special repository.
So maven tried to check the artifacts against the invalid repository.
My solution:
Remove the _maven.repositories files.
You need to check your settings.xml file under <maven_home>/conf directory.
This is one of the most annoying things about Maven. For me the following happens: If I add a dependency requesting more dependencies and more and more but have a slow connection, it seams to stop while downloading and timing out. While timing out all dependencies not yet fetched are marked with place holders in the .m2 cache and Maven will not (never) pick it up unless I remove the place holder entry from the cache (as other stated) by removing it.
So as far as I see it, Maven or more precise the Eclipse Maven plugin has a bug regarding this. Someone should report this.
It's important to add that the main difference of running mvn with -U and without -U is that -U will override your local SNAPSHOT jars with remote SNAPSHOT jars.
Local SNAPSHOT jars created from local mvn install in cases where you have other modules of your proj that generate jars.
For fixing this issue from Eclipse:
1) Add below dependency in Maven pom.xml and save the pom.xml file.
<!-- https://mvnrepository.com/artifact/com.thoughtworks.xstream/xstream -->
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.3.1</version>
</dependency>
2) Go to project >> Maven >> Update Project
select the project and click OK.
3) Optional step, if it's not resolved till step 2 then do below step after doing step-1
Go to project >> Maven >> Update Project >> check in the checkbox 'Force Update of Snapshots/Releases'
select the project and click OK.
-U is used to force update maven Repo.
Use
mvn -U clean install
I've got the same error with android-maps-utils dependency. Using aar type package in dependency section solve my problem.
By default type is jar so It might be checked what type of dependency in repository is downloaded.
I tried all the answers here but nothing seemed to work. Restarted my computer first then ran mvn clean install -U. That solved my problem.
What maven does is, it downloads all your project's dependencies into your local repo (.m2 folder). Because of the internet causing issues with your local repo, you project is facing problems. I am not sure if this will surely help you or not but you can try deleting all the files within the repository folder inside the .m2 folder. Since there would be nothing in the local repo, maven would be forced to download the dependencies again, thus forcing an update.
Generally, the .m2 folder is located at c:users:[username]:.m2
after using mvn clean install -U run as maven test also and after that update your project using maven-update project
this works in my case
I had this problem for a different reason. I went to the maven repository https://mvnrepository.com looking for the latest version of spring core, which at the time was 5.0.0.M3/ The repository showed me this entry for my pom.xml:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.0.0.M3</version>
</dependency>
Naive fool that I am, I assumed that the comment was telling me that the jar is located in the default repository.
However, after a lot of head-banging, I saw a note just below the xml saying "Note: this artifact it located at Alfresco Public repository (https://artifacts.alfresco.com/nexus/content/repositories/public/)"
So the comment in the XML is completely misleading. The jar is located in another archive, which was why Maven couldn't find it!
We can force to get latest update of release and snapshot repository with below command :
mvn --update-snapshots clean install
I had the same error and running mvn install -U and then running mvn install worked for me.
mvn clean install -U doesn't work. However mvn -U clean followed by mvn clean install does.

Jenkins Deploy Artifacts to Nexus using Deploy to Maven Repository

We have a scenario to deploy the artifact generated from maven build to Nexus. The Jenkins job would run goals clean package. The artifact should go to SNAPSHOT repo if the pom.xml has a SNAPSHOT version. If the pom.xml has a release version, the artifact should go to release repo. Any idea how we can achieve this using the Deploy to Maven Repository plugin. As of now I am using the below script in Execute Shell.
#!/bin/bash
var1=$1
var2="SNAPSHOT"
if [[ $(echo "$var1"|grep -i "$var2" | wc -l | tr -d ' ') -gt 0 ]]; then
exit 1
else
exit 0
fi
In Flexible Publish post build action, I am using Execute Shell conditional action. Based on the result of the script, I would execute the Deploy to Maven repository post build action. This can only help to deploy to release repo. Any better way of doing it.
I assume that if you cannot update pom files in repositories, you have two options:
There is a Maven Project plugin, which allows you to add a new post-build action Deploy artifacts to Maven repository. It allows you to set repository URL and name, along with few other options. Setting repository with snapshot policy as a target one will result in successful upload of snapshot artifacts. Note that
the step is available only if build type is Maven build (2/3)
upload will fail with Bad request error if you try to upload release artifact
In case adding a plugin is not an option, you can use dirty hack and alter pom file on-the-fly as the first build step via something like sed. That's risky and should not be used if not absolutely inevitable.
To update all builds at once I'd recommend either use some plugin (Configuration Slicing plugin as an option) or alter config.xml files directly via script from CLI and then use "Reload configuration" in Jenkins.
I believe that this functionality is built into Maven itself; you can specify a different <repository> and <snapshotRepository> in your <distrobutionManagement> block. (See docs)

couldn't create maven project [duplicate]

I imported my already working project on another computer and it started to download dependencies.
Apparently my internet connection crashed and now I get the following:
>Build errors for comics; org.apache.maven.lifecycle.LifecycleExecutionException:
Failed to execute goal on project comicsTest: Could not resolve dependencies for project comicsTest:comicsTest:war:0.0.1-SNAPSHOT:
The following artifacts could not be resolved:
org.springframework:spring-context:jar:3.0.5.RELEASE,
org.hibernate:hibernate-entitymanager:jar:3.6.0.Final,
org.hibernate:hibernate-core:jar:3.6.0.Final,
org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final,
org.aspectj:aspectjweaver:jar:1.6.8,
commons-lang:commons-lang:jar:2.5,
>mysql:mysql-connector-java:jar:5.1.13: Failure to transfer org.springframework:spring-context:jar:3.0.5.RELEASE from http://repo1.maven.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced.
>Original error: Could not transfer artifact org.springframework:spring-context:jar:3.0.5.RELEASE from central (http://repo1.maven.org/maven2): No response received after 60000
How do I force maven to update?
mvn clean install -U
-U means force update of snapshot dependencies.
Release dependencies will be updated this way if they have never been previously successfully downloaded. ref: https://stackoverflow.com/a/29020990/32453
If your local repository is somehow mucked up for release jars as opposed to snapshots (-U and --update-snapshots only update snapshots), you can purge the local repo using the following:
mvn dependency:purge-local-repository
You probably then want to clean and install again:
mvn dependency:purge-local-repository clean install
Lots more info available at https://maven.apache.org/plugins/maven-dependency-plugin/examples/purging-local-repository.html
-U seems to force update of all SNAPSHOT dependencies.
If you want to update a single dependency without clean or -U you could just remove it from your local repo and then build.
The example below if for updating slf4j-api 1.7.1-SNAPSHOT:
rm -rf ~/.m2/repository/org/slf4j/slf4j-api/1.7.1-SNAPSHOT
mvn compile
All the answers here didn't work for me. I used the hammer method:
find ~/.m2/ -name "*.lastUpdated" | xargs rm
That fixed the problem :-)
You can do effectively from Eclipse IDE. Of course if you are using it.
Project_Name->Maven->Update Project Configuration->Force Update of Snapshots/Releases
Just in case someone wants only update project's snapshot dependencies and doesn't want to install artifact:
mvn dependency:resolve -U
Don't forget to reimport dependencies in your IDE. In IDEA you need to right click on pom file and choose Maven -> Reimport
If you're unsure what is inside your local repository, I recommend to fire a build with the option:
-Dmaven.repo.local=localrepo
That way you'll ensure to build in a cleanroom environment.
In my case first I did was:
mvn clean install -U
Still it was showing same error then I closed project and again reopened it. Finally worked.
If you are using eclipse IDE then :
Select Project.
Press alt+F5, window for Update Maven Project will pop up.
Check - Force Update of Snapshots/releases and click OK.
If Using Intellij IDE
go to settings/Maven
check Always update snapshots
I used the IntelliJ IDE and I had a similar problem and to solve I clicked in "Generate Sources and Update Folders for All Projects" in Maven tab.
Previous versions of maven did not force the check for missing releases when used -U with mvn clean install, only the snapshots, though newer version supports this.
For someone still struggling with previous version, following can be helpful-
On Windows:
cd %userprofile%\.m2\repository
for /r %i in (*.lastUpdated) do del %i
On Linux:
find ~/.m2 -name "*.lastUpdated" -exec grep -q "Could not transfer" {} \; -print -exec rm {} \;
Whenever maven can't download dependencies for any reason (connectivity/not exists etc), it will add the ".error=Could not transfer artifact" in dependency-name.lastUpdate file in respective folder under $home/.m2 directory. Removing these files will force maven to try fetching the dependencies again.
mvn clean install -e -U -Dmaven.test.skip=true
-e Detailed exception
-U forced update
-DskipTests does not execute test cases, but compiles test case classes to generate corresponding class files under target/test classes.
-Dmaven.test.skip=true, do not execute test cases or compile test case classes.Using maven. test. skip not only skips running unit tests, but also skips compiling test code.
A small suggestion. If you use the IntelliJ Idea compiler, it is recommended to clean the cache
I've got the error in an other context.
So my solution might be useful to others who stumple upon the question:
The problem:
I've copied the local repository to another computer, which has no connection to a special repository.
So maven tried to check the artifacts against the invalid repository.
My solution:
Remove the _maven.repositories files.
You need to check your settings.xml file under <maven_home>/conf directory.
This is one of the most annoying things about Maven. For me the following happens: If I add a dependency requesting more dependencies and more and more but have a slow connection, it seams to stop while downloading and timing out. While timing out all dependencies not yet fetched are marked with place holders in the .m2 cache and Maven will not (never) pick it up unless I remove the place holder entry from the cache (as other stated) by removing it.
So as far as I see it, Maven or more precise the Eclipse Maven plugin has a bug regarding this. Someone should report this.
It's important to add that the main difference of running mvn with -U and without -U is that -U will override your local SNAPSHOT jars with remote SNAPSHOT jars.
Local SNAPSHOT jars created from local mvn install in cases where you have other modules of your proj that generate jars.
For fixing this issue from Eclipse:
1) Add below dependency in Maven pom.xml and save the pom.xml file.
<!-- https://mvnrepository.com/artifact/com.thoughtworks.xstream/xstream -->
<dependency>
<groupId>com.thoughtworks.xstream</groupId>
<artifactId>xstream</artifactId>
<version>1.3.1</version>
</dependency>
2) Go to project >> Maven >> Update Project
select the project and click OK.
3) Optional step, if it's not resolved till step 2 then do below step after doing step-1
Go to project >> Maven >> Update Project >> check in the checkbox 'Force Update of Snapshots/Releases'
select the project and click OK.
-U is used to force update maven Repo.
Use
mvn -U clean install
I've got the same error with android-maps-utils dependency. Using aar type package in dependency section solve my problem.
By default type is jar so It might be checked what type of dependency in repository is downloaded.
I tried all the answers here but nothing seemed to work. Restarted my computer first then ran mvn clean install -U. That solved my problem.
What maven does is, it downloads all your project's dependencies into your local repo (.m2 folder). Because of the internet causing issues with your local repo, you project is facing problems. I am not sure if this will surely help you or not but you can try deleting all the files within the repository folder inside the .m2 folder. Since there would be nothing in the local repo, maven would be forced to download the dependencies again, thus forcing an update.
Generally, the .m2 folder is located at c:users:[username]:.m2
after using mvn clean install -U run as maven test also and after that update your project using maven-update project
this works in my case
I had this problem for a different reason. I went to the maven repository https://mvnrepository.com looking for the latest version of spring core, which at the time was 5.0.0.M3/ The repository showed me this entry for my pom.xml:
<!-- https://mvnrepository.com/artifact/org.springframework/spring-core -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>5.0.0.M3</version>
</dependency>
Naive fool that I am, I assumed that the comment was telling me that the jar is located in the default repository.
However, after a lot of head-banging, I saw a note just below the xml saying "Note: this artifact it located at Alfresco Public repository (https://artifacts.alfresco.com/nexus/content/repositories/public/)"
So the comment in the XML is completely misleading. The jar is located in another archive, which was why Maven couldn't find it!
We can force to get latest update of release and snapshot repository with below command :
mvn --update-snapshots clean install
I had the same error and running mvn install -U and then running mvn install worked for me.
mvn clean install -U doesn't work. However mvn -U clean followed by mvn clean install does.

maven - using local source instead of external dependency

If someone could help me out here it would save me a lot of time.
I maintain an open source library that gets pushed out to a sonatype repository. I make changes to that library a few times a day and push it out to the 1.0_snapshot build using mvn deploy.
Let's call it project1
I work constantly in another project that uses that library let's call it project2.
Right now, whenever i make changes to project 1 or 2, i need to first build and deploy project 1 to the repo, then build project 2 so it downloads a fresh copy of project1.jar
Project2 has Project1 as a dependency in a pom.xml:
<dependency>
<groupId>com.group</groupId>
<artifactId>project1</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
in order to build in a way where all of my changes can be tested, I have to do something like this:
mvn -f ./project1/pom.xml clean deploy
mvn -U -f ./project2/pom.xml clean package
this uploads my project1.jar to sonatype, then project2 downloads the new snapshot and builds it.
This is a simplified picture of what i'm doing on a larger scale, where my compiles take 5 minutes of up and downloads.
Question: What is the proper way to use maven so it knows to use the source of project1 in a dependency in project 2?
IDE:
install m2e in eclipse
import your both projects into workspace
from consumer project (right click > maven > enable workspace resolution)
this will put project2's classes in classpath from its target/classes instead of the actual jar
native straight maven:
You can create a maven project tree, if this two are open source project going through same build cycle it must have one already, if they are not related but related for your usecase then you can temporarily create a maven tree on top of these 2 projects and build the top parent it will build from bottom up in one command
it will find the leaf project, build it install it in maven's cache and now while building projectA it will refer it from maven's cache so no need to deploy to sonatype
You can also point project2 to build using offline mode :
mvn -o package
Then you drop the upload part of the project1 build to the remote repo.
Check the following link: Intro to repositories and How do I configure Maven for offline development?

could the first ever maven build be made offline?

The problem: you have a zipped java project distribution, which depends on several libraries like spring-core, spring-context, jacskon, testng and slf4j. The task is to make the thing buildable offline. It's okay to create project-scope local repo with all required library jars.
I've tried to do that. Looks like even as the project contains the jars it requires for javac and runtime, the build would still require internet access. Maven would still lurk into network to fetch most of its own plugins it requires for the build. I assume that maven is run with empty .m2 directory (as this may be the first launch of the build, which may be an offline build). No, I am not okay with distributing full maven repo snapshot along the project itself, as this looks like an utter mess for me.
A bit of backround: the broader task is to create windows portable-style JDK/IntelliJ Idea distribution which goes along the project and allows for some minimal java coding/running inside IDE with minimal configuration and minimal internet access. The project is targeted towards students in a computer class, with little or no control over system configuration. It is desirable to keep console build system intact for the offline mode, but I guess that maven is overly dependent on the network, so I have to ditch it in favor of good old ant.
So, what's your opinion, could we move first maven build in offline mode completely? My gut feeling is that initial maven distribution just contains the bare minimum required to pull essential plugins off the main repo and is not fully functional without seeing the main repo at least once.
Maven has a '-o' switch which allows you to build offline:
-o,--offline Work offline
Of course, you will need to have your dependencies already cached into your $HOME/.m2/repository for this to build without errors. You can load the dependencies with:
mvn dependency:go-offline
I tried this process and it doesn't seem to fully work. I did a:
rm -rf $HOME/.m2/repository
mvn dependency:go-offline # lot of stuff downloaded
# unplugged my network
# develop stuff
mvn install # errors from missing plugins
What did work however is:
rm -rf $HOME/.m2/repository
mvn install # while still online
# unplugged my network
# develop stuff
mvn install
You could run maven dependency:go-offline on a brand new .m2 repo for the concerned project. This should download everything that maven needs to be able to run offline. If these are then put into a project-scope local repo, you should be able to achieve what you want. I haven't tried this though
Specify a local repository location, either within settings.xml file with <localRepository>...</localRepository> or by running mvn with -Dmaven.repo.local=... parameter.
After initial project build, all necessary artifacts should be cached locally, and you can reference this repository location the same ways, while running other Maven builds in offline mode (mvn -o ...).

Categories