We have product help document which is about 150Mb and being build every day and updated to maven repo.
So when we build the project which has dependency on help document it will download entire 150Mb once everyday and it takes lot of time.
Is there any way to avoid it?
Like give an entry in pom.xml
<properties>
<download.docmodule>true</download.docmodule>
</properties>
And in users settings.xml
<download.docmodule>false</download.docmodule>
And use this attribute to stop downloading the document?
Basically I want CI server to download it and package it but want developers not to waste time and bandwidth downloading it
<dependency>
<groupId>docmodules</groupId>
<artifactId>projname</artifactId>
<version>${documentation.version}</version>
<classifier>resources</classifier>
<type>zip</type>
<scope>provided</scope>
</dependency>
You can use profiles like:
<profiles>
<profile>
<id>donloadHelp</id>
<dependencies>
<dependency>
//Add your dependency
</dependency>
</dependencies>
</profile>
</profiles>
The help will only downloaded if you activate the profile in maven.
To activate the profile, you have to call
mvn <target> -PdownloadHelp
Related
I am trying to update a plugin [in 1.18.2] that I haven't written myself to minecraft 1.19.3.
However I am struggling with figuring out how to add craftbukkit as a dependency. I use maven and it seems to be unfindable for 1.19.3 in the mvnrepository.com. Further investigation led me to buildtools, which I ran and it did give me several folders and jar files, one of which is craftbukkit, spigot and bukkit.
However trying to add those jar files as dependencies also gave me errors of referencing to a non-existing file. Even though the file does exist in the resource folder of the project.
<dependency>
<groupId>org.bukkit</groupId>
<artifactId>craftbukkit</artifactId>
<version>1.19.3-R0.1-SNAPSHOT</version>
<scope>system</scope>
<systemPath>/GUIMarketplaceDirectory-master/src/main/resources/craftbukkit-1.19.3.jar</systemPath>
</dependency>
I also tried changing the path to start at my very source folder, but this didn't work. Any help would be appreciated.
I'm not sure you can add CraftBukkit as a dependency. It needs to be either bukkit, or spigot, since CraftBukkit is a server mod, not the plugin API. Here is code for a Spigot import.
<repositories>
<!-- This adds the Spigot Maven repository to the build -->
<repository>
<id>spigot-repo</id>
<url>https://hub.spigotmc.org/nexus/content/repositories/snapshots/</url>
</repository>
</repositories>
<properties>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<dependencies>
<!--This adds the Spigot API artifact to the build -->
<dependency>
<groupId>org.spigotmc</groupId>
<artifactId>spigot-api</artifactId>
<version>1.19.3-R0.1-SNAPSHOT</version>
<scope>provided</scope>
</dependency>
</dependencies>
I am using the maven-ear-plugin to build an ear file with skinny wars.
I am working with another team that provides daily snapshots And what I am
getting is the situation if I have not built snapshots locally then
The ear file has the daily builds (which is good) and the war files
have my most recent snapshot (which is not good).
e.g. the ear file will have
imported1-2017-010101.jar
and the war file will have
imported1-SNAPSHOT.jar
It seems that this is happening due to the daily build having a date stamp in their name while the snapshot does not.
If I build snapshots of the imported libraries prior to building the ear file.
e.g. the ear file will have
imported1-SNAPSHOT.jar
and the war file will not have the library.
this is the ear configuration
<profile>
<id>skinny</id>
<activation>
<property>
<name>!skinny</name>
</property>
</activation>
<dependencies>
<dependency>
<groupId>my.library</groupId>
<artifactId>war-1</artifactId>
<type>pom</type>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>my.library</groupId>
<artifactId>war-2</artifactId>
<type>pom</type>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-ear-plugin</artifactId>
<configuration>
<defaultLibBundleDir>/lib</defaultLibBundleDir>
<skinnyWars>true</skinnyWars>
</configuration>
</plugin>
</plugins>
</build>
</profile>
Have I got something wrong or does the plugin just not work in this case?
I resolved this by reviewing my Maven Repository snapshot behaviour.
I'm using Artifactory as maven Repository. It allows you to choose between 3 different behaviours to name you Snapshot, one of them using timestamp, other using -SNAPSHOT, and other accept the deployer choosen name.
I've changed my snapshot behaviour to -SNAPSHOT, removed older versions of snapshots from repository (I don't know if this is really necessary), and skinnyWars are now created correctly.
[]'s
I am facing a situation, where I thought that Maven offers me the correct tools.
Either I am wrong or Maven ;o)
Seriously.
We are writing software to work with a 3rd party lib, let's call it prod.jar. This lib needs an environment that can connect to the prod.jar servers.
Obviously, our Jenkins is not and cannot be set up in this way. Thus, when running the tests with the prod.jar, everything will fail, as no connection can be set up.
My idea was to write a simulator that behaves like the real prod.jar and can be used for unit tests, called simulator.jar. Both, the prod.jar and the simulator.jar hold the same packages with the same class names. They only do differ in functionality. I have done this, to enable development and to cover as much on JUnit side on Jenkins. Of course, we also do test against the prod.jar, but not with Jenkins.
So what I did is to create two eclipse projects:
prod-code: with a pom.xml that has prod.jar as a dependency
simulator-code: with a pom.xml that has the simulator.jar as a dependency
So depending on which project you add as a dependency to the main project, either the simulator or the prod code are used. That works fine.
But then we get the error that the build contains the wrong jar.
How can I set up maven, if possible, so that I can use always the same pom, but maybe with different mvn parameters, to use the simulator during the test process and to use the prod code during the build process.
I tried with maven profiles, but when using the build jar, it will complain.
<profiles>
<profile>
<id>simulator</id>
<dependencies>
<dependency>
<groupId>main-project</groupId>
<artifactId>simulator</artifactId>
</dependency>
</dependencies>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
</profile>
<profile>
<id>jenkins</id>
<dependency>
<groupId>main-project</groupId>
<artifactId>simulator</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>main-project/groupId>
<artifactId>prod</artifactId>
</dependency>
</dependencies>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
</profile>
<profile>
<id>realSystem</id>
<dependencies>
<dependency>
<groupId>main-project</groupId>
<artifactId>prod</artifactId>
</dependency>
</dependencies>
<activation>
<activeByDefault>false</activeByDefault>
</activation>
</profile>
</profiles>
Any help appreciated.
Many thanks in advance.
Update: As soon as I posted this, the repository URL began working. However, If you know how to address this, please enlighten me since I can see this happening again. Thank you all very much.
New to maven here.
I'm using RichFaces 4 and Netbeans 7
When I package the app gets:
http://download.java.net/maven/2/org/richfaces/richfaces-bom/4.0.0-SNAPSHOT/maven-metadata.xml
That URL is currently unavailable. As such, I'm not able to run my app because the build fails.
There must be a way around this and it's probably simple but my searches have come up with nothing.
Here are the relevent parts of my pom.xml
<repository>
<id>java-net</id>
<name>Java.net Maven Repository</name>
<url>http://download.java.net/maven/2</url>
</repository>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Setting this property using archetype-metadata.xml requiredPorperty
so that generated project uses correct version of richfaces.
-->
<org.richfaces.bom.version>4.0.0-SNAPSHOT</org.richfaces.bom.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.richfaces</groupId>
<artifactId>richfaces-bom</artifactId>
<version>${org.richfaces.bom.version}</version>
<scope>import</scope>
<type>pom</type>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.richfaces.ui</groupId>
<artifactId>richfaces-components-ui</artifactId>
</dependency>
<dependency>
<groupId>org.richfaces.core</groupId>
<artifactId>richfaces-core-impl</artifactId>
</dependency>
<dependencies>
I've tried setting up mirrors in my settings but it appears to be incomplete since it's not working for me. Here is my attempt at the mirror.
Note: I randomly selected the mirror so it's probably not what I want. Just trial and error to see what would happen.
<mirrors>
<mirror>
<id>RM</id>
<name>Java Net Mirror</name>
<url>http://repo1.maven.org/maven2</url>
<mirrorOf>java-net</mirrorOf>
</mirror>
Thanks in advance for any help you can sen my way.
You should definitly install a repository manager like Archiva, Nexus or Artifactory (http://www.jfrog.com/products.php) to avoid situations like this.
A Repository Manager will cache the external or self-generated maven artifacts for you and is really indispensible for any serious maven work.
I am new to Maven and I have very basic question. I have one J2EE app(EAR). When I build this app I want to ignore some dependency in lib folder of my war as this jars will be provided by my server like jboss(all hibernate stuff). But when I run this war project inside embedded jetty server then I need it to be inside my lib folder. I heard about the maven profile which can be used for similar purpose. Can somebody give me an example or some detail about it or is there some other way to achieve this task. I have an EAR which contains ejb module(jar) and web module(war).
Thanks
Specify your library in a profile. Set <scope>provided</scope> for your library in a jboss profile. E.g.:
<profiles>
<profile>
<id>jboss</id>
…
<dependencies>
<dependency>
<groupid>...</groupid>
<artifactid>...</artifactid>
<version>...</version>
<scope>provided</scope>
</dependency>
</dependencies>
…
</profile>
<profile>
<id>jetty</id>
…
<dependencies>
<dependency>
<groupid>...</groupid>
<artifactid>...</artifactid>
<version>...</version>
</dependency>
</dependencies>
…
</profile>
</profiles>