2

Sorry for asking a question that many will say it has been asked again and again, however I couldn't find a satisfactory or complete answer.

I have to build a maven project. Inside it I have the following:

<profile>
  <id>windows</id>
  <activation>
    <os>
      <family>Windows</family>
    </os>
  </activation>
  <properties>
    <weblogic.home>${env.WEBLOGIC_SERVER_HOME}</weblogic.home>
    <weblogic.precompilation.java.home>${env.JAVA_64_HOME}</weblogic.precompilation.java.home>
  </properties>
</profile>

and I get the error:

[ERROR] 'dependencyManagement.dependencies.dependency.systemPath' for weblogic:weblogic.jar must specify an absolute path but is ${env.WEBLOGIC_SERVER_HOME}/server/lib/weblogic.jar @ ..\pom.xml

Of course, by setting the absolute path to the above:

<weblogic.home>c:/Oracle/Middleware/wlserver_10.3</weblogic.home>

the problem is solved, but how can I actually set env.WEBLOGIC_SERVER_HOME in my system so that maven finds it?

I setup a new environment variable:

WEBLOGIC_SERVER_HOME = c:/Oracle/Middleware/wlserver_10.3

in my Windows machine but no luck. I tried setting configuration environmentVariables in maven-surefire-plugin as explained in [How to set up an environment variable in mvn pom? (but didn't pass it via -D in the command line), tried to set a property like here [How to refer environment variable in POM.xml? but no chance.

I thought that once I setup the environment variable (WEBLOGIC_SERVER_HOME) in my OS, I could then access it from my pom using ${env.WEBLOGIC_SERVER_HOME}. But I guess this is not enough.

In my IDE (NetBeans), I cannot set the environment variable for the maven project since it displays the "Resolve Project Problems" dialog box instead.

Any help is appreciated.

J Kost
  • 41
  • 1
  • 7
  • Could you share the whole pom.xml or the dependencyManagement section, where you are probably defining the weblogic dependency? – Ioannis Sermetziadis Dec 01 '17 at 11:53
  • I would suggest to upload the weblogic.jar to a repository manager and set the dependency in your pom to `provided` than you will get be rid of the environment variables... – khmarbaise Dec 01 '17 at 16:06

0 Answers0